Code: refresh code
This commit is contained in:
@ -18,6 +18,7 @@ const (
|
||||
Socks5
|
||||
Http
|
||||
Vmess
|
||||
Vless
|
||||
Trojan
|
||||
|
||||
Relay
|
||||
@ -132,6 +133,8 @@ func (at AdapterType) String() string {
|
||||
return "Http"
|
||||
case Vmess:
|
||||
return "Vmess"
|
||||
case Vless:
|
||||
return "Vless"
|
||||
case Trojan:
|
||||
return "Trojan"
|
||||
|
||||
|
@ -14,12 +14,14 @@ const (
|
||||
|
||||
TCP NetWork = iota
|
||||
UDP
|
||||
ALLNet
|
||||
|
||||
HTTP Type = iota
|
||||
HTTPCONNECT
|
||||
SOCKS
|
||||
REDIR
|
||||
TPROXY
|
||||
TUN
|
||||
)
|
||||
|
||||
type NetWork int
|
||||
@ -27,8 +29,10 @@ type NetWork int
|
||||
func (n NetWork) String() string {
|
||||
if n == TCP {
|
||||
return "tcp"
|
||||
} else if n == UDP {
|
||||
return "udp"
|
||||
}
|
||||
return "udp"
|
||||
return "all"
|
||||
}
|
||||
|
||||
func (n NetWork) MarshalJSON() ([]byte, error) {
|
||||
@ -49,6 +53,8 @@ func (t Type) String() string {
|
||||
return "Redir"
|
||||
case TPROXY:
|
||||
return "TProxy"
|
||||
case TUN:
|
||||
return "Tun"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
@ -68,6 +74,7 @@ type Metadata struct {
|
||||
DstPort string `json:"destinationPort"`
|
||||
AddrType int `json:"-"`
|
||||
Host string `json:"host"`
|
||||
Process string `json:"process"`
|
||||
}
|
||||
|
||||
func (m *Metadata) RemoteAddress() string {
|
||||
|
@ -60,3 +60,15 @@ func (p *path) MMDB() string {
|
||||
func (p *path) Cache() string {
|
||||
return P.Join(p.homeDir, ".cache")
|
||||
}
|
||||
|
||||
func (p *path) GeoIP() string {
|
||||
return P.Join(p.homeDir, "geoip.dat")
|
||||
}
|
||||
|
||||
func (p *path) GeoSite() string {
|
||||
return P.Join(p.homeDir, "geosite.dat")
|
||||
}
|
||||
|
||||
func (p *path) GetAssetLocation(file string) string {
|
||||
return P.Join(p.homeDir, file)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ const (
|
||||
Domain RuleType = iota
|
||||
DomainSuffix
|
||||
DomainKeyword
|
||||
GEOSITE
|
||||
GEOIP
|
||||
IPCIDR
|
||||
SrcIPCIDR
|
||||
@ -24,6 +25,8 @@ func (rt RuleType) String() string {
|
||||
return "DomainSuffix"
|
||||
case DomainKeyword:
|
||||
return "DomainKeyword"
|
||||
case GEOSITE:
|
||||
return "GeoSite"
|
||||
case GEOIP:
|
||||
return "GeoIP"
|
||||
case IPCIDR:
|
||||
@ -49,4 +52,5 @@ type Rule interface {
|
||||
Adapter() string
|
||||
Payload() string
|
||||
ShouldResolveIP() bool
|
||||
NetWork() NetWork
|
||||
}
|
||||
|
Reference in New Issue
Block a user