This commit is contained in:
2024-03-11 21:00:13 +08:00
parent 665da8fc45
commit daa3ab6867
18 changed files with 80 additions and 100 deletions

View File

@ -91,7 +91,7 @@ type DNSRule struct {
Type string `json:"type,omitempty"`
Inbound Listable[string] `json:"inbound,omitempty"`
IPVersion int `json:"ip_version,omitempty"`
QueryType Listable[uint16] `json:"query_type,omitempty"`
QueryType Listable[string] `json:"query_type,omitempty"`
Network Listable[string] `json:"network,omitempty"`
AuthUser Listable[string] `json:"auth_user,omitempty"`
Protocol Listable[string] `json:"protocol,omitempty"`
@ -126,7 +126,7 @@ type DNSRule struct {
DisableCache bool `json:"disable_cache,omitempty"`
RewriteTTL uint32 `json:"rewrite_ttl,omitempty"`
ClientSubnet string `json:"client_subnet,omitempty"`
Mode string `json:"mode"`
Mode string `json:"mode,omitempty"`
Rules Listable[DNSRule] `json:"rules,omitempty"`
}

View File

@ -1,8 +1,6 @@
package model
type Hysteria struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
Up string `json:"up,omitempty"`

View File

@ -6,8 +6,6 @@ type Hysteria2Obfs struct {
}
type Hysteria2 struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
UpMbps int `json:"up_mbps,omitempty"`

View File

@ -6,6 +6,7 @@ import (
type Proxy struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Shadowsocks `json:"-"`
VMess `json:"-"`
VLESS `json:"-"`
@ -20,57 +21,71 @@ func (p *Proxy) MarshalJSON() ([]byte, error) {
case "shadowsocks":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Shadowsocks
}{
Type: p.Type,
Tag: p.Tag,
Shadowsocks: p.Shadowsocks,
})
case "vmess":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
VMess
}{
Type: p.Type,
Tag: p.Tag,
VMess: p.VMess,
})
case "vless":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
VLESS
}{
Type: p.Type,
Tag: p.Tag,
VLESS: p.VLESS,
})
case "trojan":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Trojan
}{
Type: p.Type,
Tag: p.Tag,
Trojan: p.Trojan,
})
case "tuic":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
TUIC
}{
Type: p.Type,
Tag: p.Tag,
TUIC: p.TUIC,
})
case "hysteria":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Hysteria
}{
Type: p.Type,
Tag: p.Tag,
Hysteria: p.Hysteria,
})
case "hysteria2":
return json.Marshal(&struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Hysteria2
}{
Type: p.Type,
Tag: p.Tag,
Hysteria2: p.Hysteria2,
})
default:

View File

@ -1,7 +1,6 @@
package model
type Shadowsocks struct {
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
Method string `json:"method"`

View File

@ -1,8 +1,6 @@
package model
type Trojan struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
Password string `json:"password"`

View File

@ -1,8 +1,6 @@
package model
type TUIC struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
UUID string `json:"uuid,omitempty"`

View File

@ -1,8 +1,6 @@
package model
type VLESS struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
UUID string `json:"uuid"`

View File

@ -19,8 +19,6 @@ type VmessJson struct {
}
type VMess struct {
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Server string `json:"server"`
ServerPort uint16 `json:"server_port"`
UUID string `json:"uuid"`