mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-07-04 10:19:52 +00:00
chore(tun): show error on unsupported platform
This commit is contained in:
parent
2e93c12cdc
commit
b287020daa
@ -9,6 +9,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -684,6 +686,10 @@ func clientTCPRedirect(config tcpRedirectConfig, c client.Client) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func clientTUN(config tunConfig, c client.Client) error {
|
func clientTUN(config tunConfig, c client.Client) error {
|
||||||
|
supportedPlatforms := []string{"linux", "darwin", "windows", "android"}
|
||||||
|
if !slices.Contains(supportedPlatforms, runtime.GOOS) {
|
||||||
|
logger.Error("TUN is not supported on this platform", zap.String("platform", runtime.GOOS))
|
||||||
|
}
|
||||||
if config.Name == "" {
|
if config.Name == "" {
|
||||||
return configError{Field: "name", Err: errors.New("name is empty")}
|
return configError{Field: "name", Err: errors.New("name is empty")}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user