From b287020daa691adad2b2e4915b87c04aef3f6d7d Mon Sep 17 00:00:00 2001 From: Haruue Date: Wed, 20 Mar 2024 22:09:03 +0800 Subject: [PATCH] chore(tun): show error on unsupported platform --- app/cmd/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/cmd/client.go b/app/cmd/client.go index 42c5a3a..79afd59 100644 --- a/app/cmd/client.go +++ b/app/cmd/client.go @@ -9,6 +9,8 @@ import ( "net" "net/netip" "os" + "runtime" + "slices" "strconv" "strings" "time" @@ -684,6 +686,10 @@ func clientTCPRedirect(config tcpRedirectConfig, 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 == "" { return configError{Field: "name", Err: errors.New("name is empty")} }