Add android vpn options Support proxies icon configuration Optimize android immersion display Fix some issues
60 lines
1.7 KiB
Go
60 lines
1.7 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"`
|
|
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"`
|
|
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
|
|
}
|