Skip to content

Commit

Permalink
UseIPv6 config
Browse files Browse the repository at this point in the history
  • Loading branch information
xxf098 committed Jul 12, 2020
1 parent 14c5731 commit bf21dbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,12 @@ func createVmessOutboundDetourConfig(profile *Vmess) conf.OutboundDetourConfig {
return vmessOutboundDetourConfig
}

func createFreedomOutboundDetourConfig() conf.OutboundDetourConfig {
outboundsSettings2, _ := json.Marshal(v2ray.OutboundsSettings{DomainStrategy: "UseIP"})
func createFreedomOutboundDetourConfig(useIPv6 bool) conf.OutboundDetourConfig {
domainStrategy := "useipv4"
if useIPv6 {
domainStrategy = "useip"
}
outboundsSettings2, _ := json.Marshal(v2ray.OutboundsSettings{DomainStrategy: domainStrategy})
outboundsSettingsMsg2 := json.RawMessage(outboundsSettings2)
return conf.OutboundDetourConfig{
Protocol: "freedom",
Expand Down
6 changes: 4 additions & 2 deletions tun2socks.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ type Vmess struct {
Security string // vnext.Security
RouteMode int // for SSRRAY
DNS string // DNS Config
UseIPv6 bool
Loglevel string
}

// TODO: default value
func NewVmess(Host string, Path string, TLS string, Add string, Port int, Aid int, Net string, ID string, Type string, Security string, RouteMode int, DNS string, Loglevel string) *Vmess {
func NewVmess(Host string, Path string, TLS string, Add string, Port int, Aid int, Net string, ID string, Type string, Security string, RouteMode int, DNS string, UseIPv6 bool, Loglevel string) *Vmess {
return &Vmess{
Host: Host,
Path: Path,
Expand All @@ -81,6 +82,7 @@ func NewVmess(Host string, Path string, TLS string, Add string, Port int, Aid in
Security: Security,
RouteMode: RouteMode,
DNS: DNS,
UseIPv6: UseIPv6,
Loglevel: Loglevel,
}
}
Expand Down Expand Up @@ -237,7 +239,7 @@ func loadVmessConfig(profile *Vmess) (*conf.Config, error) {
// },
// }
vmessOutboundDetourConfig := createVmessOutboundDetourConfig(profile)
freedomOutboundDetourConfig := createFreedomOutboundDetourConfig()
freedomOutboundDetourConfig := createFreedomOutboundDetourConfig(profile.UseIPv6)
// order matters
// GFWList mode, use 'direct' as default
if profile.RouteMode == 4 {
Expand Down

0 comments on commit bf21dbe

Please sign in to comment.