Skip to content

Commit a2f62a6

Browse files
author
yiguo
committed
only initIpRoute when mode is tun for Linux
1 parent ca5d5c8 commit a2f62a6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

desktop_bin/run.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
)
1010

1111
type runXrayConfig struct {
12+
// tun / proxy
13+
Mode string `json:"mode,omitempty"`
1214
// tun
1315
TunName string `json:"tunName,omitempty"`
1416
TunPriority int `json:"tunPriority,omitempty"`
@@ -30,10 +32,12 @@ func runXray(configPath string) error {
3032
if err != nil {
3133
return err
3234
}
33-
err = initIpRoute(config.TunName, config.TunPriority)
34-
if err != nil {
35-
return err
35+
if config.Mode == "tun" {
36+
err = initIpRoute(config.TunName, config.TunPriority)
37+
if err != nil {
38+
return err
39+
}
40+
dns.InitDns(config.Dns, config.BindInterface)
3641
}
37-
dns.InitDns(config.Dns, config.BindInterface)
3842
return xray.RunXray(config.DatDir, config.ConfigPath)
3943
}

0 commit comments

Comments
 (0)