Add back urltest outbound

This commit is contained in:
世界
2022-09-15 15:22:08 +08:00
parent 4d24cf5ec4
commit a5402ffb69
16 changed files with 434 additions and 45 deletions

View File

@@ -14,3 +14,10 @@ type SelectorOutboundOptions struct {
Outbounds []string `json:"outbounds"`
Default string `json:"default,omitempty"`
}
type URLTestOutboundOptions struct {
Outbounds []string `json:"outbounds"`
URL string `json:"url,omitempty"`
Interval Duration `json:"interval,omitempty"`
Tolerance uint16 `json:"tolerance,omitempty"`
}

View File

@@ -24,6 +24,7 @@ type _Outbound struct {
ShadowsocksROptions ShadowsocksROutboundOptions `json:"-"`
VLESSOptions VLESSOutboundOptions `json:"-"`
SelectorOptions SelectorOutboundOptions `json:"-"`
URLTestOptions URLTestOutboundOptions `json:"-"`
}
type Outbound _Outbound
@@ -61,6 +62,8 @@ func (h Outbound) MarshalJSON() ([]byte, error) {
v = h.VLESSOptions
case C.TypeSelector:
v = h.SelectorOptions
case C.TypeURLTest:
v = h.URLTestOptions
default:
return nil, E.New("unknown outbound type: ", h.Type)
}
@@ -104,6 +107,8 @@ func (h *Outbound) UnmarshalJSON(bytes []byte) error {
v = &h.VLESSOptions
case C.TypeSelector:
v = &h.SelectorOptions
case C.TypeURLTest:
v = &h.URLTestOptions
default:
return E.New("unknown outbound type: ", h.Type)
}