make tun config compatible with premium

This commit is contained in:
gVisor bot 2022-01-05 01:50:43 +08:00
parent f507672d4b
commit acf9ba1280
2 changed files with 3 additions and 3 deletions

View file

@ -209,7 +209,7 @@ func UnmarshalRawConfig(buf []byte) (*RawConfig, error) {
Tun: Tun{ Tun: Tun{
Enable: false, Enable: false,
Stack: "gvisor", Stack: "gvisor",
DnsHijack: []string{"192.18.0.2:53"}, DnsHijack: []string{"0.0.0.0:53"},
AutoRoute: true, AutoRoute: true,
AutoDetectInterface: true, AutoDetectInterface: true,
}, },

View file

@ -38,8 +38,8 @@ type tunLinux struct {
// OpenTunDevice return a TunDevice according a URL // OpenTunDevice return a TunDevice according a URL
func OpenTunDevice(tunAddress string, autoRoute bool) (TunDevice, error) { func OpenTunDevice(tunAddress string, autoRoute bool) (TunDevice, error) {
deviceURL, _ := url.Parse("dev://meta") deviceURL, _ := url.Parse("dev://meta?mtu=9000")
mtu, _ := strconv.ParseInt(deviceURL.Query().Get("mtu"), 0, 32) mtu, _ := strconv.ParseUint(deviceURL.Query().Get("mtu"), 10, 32)
t := &tunLinux{ t := &tunLinux{
url: deviceURL.String(), url: deviceURL.String(),