Support setting bypassDomain Update flutter version Fix android service issues Fix macos dock exit button issues Add route address setting Optimize provider view
62 lines
1.8 KiB
Go
62 lines
1.8 KiB
Go
package state
|
|
|
|
import "github.com/metacubex/mihomo/config"
|
|
|
|
var DefaultIpv4Address = "172.19.0.1/30"
|
|
var DefaultDnsAddress = "172.19.0.2"
|
|
var DefaultIpv6Address = "fdfe:dcba:9876::1/126"
|
|
|
|
var CurrentRawConfig = config.DefaultRawConfig()
|
|
|
|
type AndroidVpnOptions struct {
|
|
Enable bool `json:"enable"`
|
|
Port int `json:"port"`
|
|
AccessControl *AccessControl `json:"accessControl"`
|
|
AllowBypass bool `json:"allowBypass"`
|
|
SystemProxy bool `json:"systemProxy"`
|
|
BypassDomain []string `json:"bypassDomain"`
|
|
RouteAddress []string `json:"routeAddress"`
|
|
Ipv4Address string `json:"ipv4Address"`
|
|
Ipv6Address string `json:"ipv6Address"`
|
|
DnsServerAddress string `json:"dnsServerAddress"`
|
|
}
|
|
|
|
type AccessControl struct {
|
|
Mode string `json:"mode"`
|
|
AcceptList []string `json:"acceptList"`
|
|
RejectList []string `json:"rejectList"`
|
|
IsFilterSystemApp bool `json:"isFilterSystemApp"`
|
|
}
|
|
|
|
type AndroidVpnRawOptions struct {
|
|
Enable bool `json:"enable"`
|
|
AccessControl *AccessControl `json:"accessControl"`
|
|
AllowBypass bool `json:"allowBypass"`
|
|
SystemProxy bool `json:"systemProxy"`
|
|
RouteAddress []string `json:"routeAddress"`
|
|
Ipv6 bool `json:"ipv6"`
|
|
BypassDomain []string `json:"bypassDomain"`
|
|
}
|
|
|
|
type State struct {
|
|
AndroidVpnRawOptions
|
|
CurrentProfileName string `json:"currentProfileName"`
|
|
OnlyProxy bool `json:"onlyProxy"`
|
|
}
|
|
|
|
var CurrentState = &State{}
|
|
|
|
func GetIpv6Address() string {
|
|
if CurrentState.Ipv6 {
|
|
return DefaultIpv6Address
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|
|
|
|
func GetDnsServerAddress() string {
|
|
//prefix, _ := netip.ParsePrefix(DefaultIpv4Address)
|
|
//return prefix.Addr().String()
|
|
return DefaultDnsAddress
|
|
}
|