mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-04-04 04:17:36 +03:00
Refactor inbound/outbound options struct
This commit is contained in:
parent
36b0f2e91a
commit
6ddcd3954d
31 changed files with 844 additions and 697 deletions
|
@ -2,17 +2,17 @@ package option
|
|||
|
||||
type HysteriaInboundOptions struct {
|
||||
ListenOptions
|
||||
Up string `json:"up,omitempty"`
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
Down string `json:"down,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs string `json:"obfs,omitempty"`
|
||||
Users []HysteriaUser `json:"users,omitempty"`
|
||||
ReceiveWindowConn uint64 `json:"recv_window_conn,omitempty"`
|
||||
ReceiveWindowClient uint64 `json:"recv_window_client,omitempty"`
|
||||
MaxConnClient int `json:"max_conn_client,omitempty"`
|
||||
DisableMTUDiscovery bool `json:"disable_mtu_discovery,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Up string `json:"up,omitempty"`
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
Down string `json:"down,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs string `json:"obfs,omitempty"`
|
||||
Users []HysteriaUser `json:"users,omitempty"`
|
||||
ReceiveWindowConn uint64 `json:"recv_window_conn,omitempty"`
|
||||
ReceiveWindowClient uint64 `json:"recv_window_client,omitempty"`
|
||||
MaxConnClient int `json:"max_conn_client,omitempty"`
|
||||
DisableMTUDiscovery bool `json:"disable_mtu_discovery,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
}
|
||||
|
||||
type HysteriaUser struct {
|
||||
|
@ -24,16 +24,16 @@ type HysteriaUser struct {
|
|||
type HysteriaOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
Up string `json:"up,omitempty"`
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
Down string `json:"down,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs string `json:"obfs,omitempty"`
|
||||
Auth []byte `json:"auth,omitempty"`
|
||||
AuthString string `json:"auth_str,omitempty"`
|
||||
ReceiveWindowConn uint64 `json:"recv_window_conn,omitempty"`
|
||||
ReceiveWindow uint64 `json:"recv_window,omitempty"`
|
||||
DisableMTUDiscovery bool `json:"disable_mtu_discovery,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
Up string `json:"up,omitempty"`
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
Down string `json:"down,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs string `json:"obfs,omitempty"`
|
||||
Auth []byte `json:"auth,omitempty"`
|
||||
AuthString string `json:"auth_str,omitempty"`
|
||||
ReceiveWindowConn uint64 `json:"recv_window_conn,omitempty"`
|
||||
ReceiveWindow uint64 `json:"recv_window,omitempty"`
|
||||
DisableMTUDiscovery bool `json:"disable_mtu_discovery,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@ package option
|
|||
|
||||
type Hysteria2InboundOptions struct {
|
||||
ListenOptions
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs *Hysteria2Obfs `json:"obfs,omitempty"`
|
||||
Users []Hysteria2User `json:"users,omitempty"`
|
||||
IgnoreClientBandwidth bool `json:"ignore_client_bandwidth,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Masquerade string `json:"masquerade,omitempty"`
|
||||
BrutalDebug bool `json:"brutal_debug,omitempty"`
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs *Hysteria2Obfs `json:"obfs,omitempty"`
|
||||
Users []Hysteria2User `json:"users,omitempty"`
|
||||
IgnoreClientBandwidth bool `json:"ignore_client_bandwidth,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
Masquerade string `json:"masquerade,omitempty"`
|
||||
BrutalDebug bool `json:"brutal_debug,omitempty"`
|
||||
}
|
||||
|
||||
type Hysteria2Obfs struct {
|
||||
|
@ -25,11 +25,11 @@ type Hysteria2User struct {
|
|||
type Hysteria2OutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs *Hysteria2Obfs `json:"obfs,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
BrutalDebug bool `json:"brutal_debug,omitempty"`
|
||||
UpMbps int `json:"up_mbps,omitempty"`
|
||||
DownMbps int `json:"down_mbps,omitempty"`
|
||||
Obfs *Hysteria2Obfs `json:"obfs,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
BrutalDebug bool `json:"brutal_debug,omitempty"`
|
||||
}
|
||||
|
|
|
@ -31,45 +31,55 @@ type _Inbound struct {
|
|||
|
||||
type Inbound _Inbound
|
||||
|
||||
func (h Inbound) MarshalJSON() ([]byte, error) {
|
||||
var v any
|
||||
func (h *Inbound) RawOptions() (any, error) {
|
||||
var rawOptionsPtr any
|
||||
switch h.Type {
|
||||
case C.TypeTun:
|
||||
v = h.TunOptions
|
||||
rawOptionsPtr = &h.TunOptions
|
||||
case C.TypeRedirect:
|
||||
v = h.RedirectOptions
|
||||
rawOptionsPtr = &h.RedirectOptions
|
||||
case C.TypeTProxy:
|
||||
v = h.TProxyOptions
|
||||
rawOptionsPtr = &h.TProxyOptions
|
||||
case C.TypeDirect:
|
||||
v = h.DirectOptions
|
||||
rawOptionsPtr = &h.DirectOptions
|
||||
case C.TypeSOCKS:
|
||||
v = h.SocksOptions
|
||||
rawOptionsPtr = &h.SocksOptions
|
||||
case C.TypeHTTP:
|
||||
v = h.HTTPOptions
|
||||
rawOptionsPtr = &h.HTTPOptions
|
||||
case C.TypeMixed:
|
||||
v = h.MixedOptions
|
||||
rawOptionsPtr = &h.MixedOptions
|
||||
case C.TypeShadowsocks:
|
||||
v = h.ShadowsocksOptions
|
||||
rawOptionsPtr = &h.ShadowsocksOptions
|
||||
case C.TypeVMess:
|
||||
v = h.VMessOptions
|
||||
rawOptionsPtr = &h.VMessOptions
|
||||
case C.TypeTrojan:
|
||||
v = h.TrojanOptions
|
||||
rawOptionsPtr = &h.TrojanOptions
|
||||
case C.TypeNaive:
|
||||
v = h.NaiveOptions
|
||||
rawOptionsPtr = &h.NaiveOptions
|
||||
case C.TypeHysteria:
|
||||
v = h.HysteriaOptions
|
||||
rawOptionsPtr = &h.HysteriaOptions
|
||||
case C.TypeShadowTLS:
|
||||
v = h.ShadowTLSOptions
|
||||
rawOptionsPtr = &h.ShadowTLSOptions
|
||||
case C.TypeVLESS:
|
||||
v = h.VLESSOptions
|
||||
rawOptionsPtr = &h.VLESSOptions
|
||||
case C.TypeTUIC:
|
||||
v = h.TUICOptions
|
||||
rawOptionsPtr = &h.TUICOptions
|
||||
case C.TypeHysteria2:
|
||||
v = h.Hysteria2Options
|
||||
rawOptionsPtr = &h.Hysteria2Options
|
||||
case "":
|
||||
return nil, E.New("missing inbound type")
|
||||
default:
|
||||
return nil, E.New("unknown inbound type: ", h.Type)
|
||||
}
|
||||
return MarshallObjects((_Inbound)(h), v)
|
||||
return rawOptionsPtr, nil
|
||||
}
|
||||
|
||||
func (h Inbound) MarshalJSON() ([]byte, error) {
|
||||
rawOptions, err := h.RawOptions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return MarshallObjects((_Inbound)(h), rawOptions)
|
||||
}
|
||||
|
||||
func (h *Inbound) UnmarshalJSON(bytes []byte) error {
|
||||
|
@ -77,46 +87,11 @@ func (h *Inbound) UnmarshalJSON(bytes []byte) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var v any
|
||||
switch h.Type {
|
||||
case C.TypeTun:
|
||||
v = &h.TunOptions
|
||||
case C.TypeRedirect:
|
||||
v = &h.RedirectOptions
|
||||
case C.TypeTProxy:
|
||||
v = &h.TProxyOptions
|
||||
case C.TypeDirect:
|
||||
v = &h.DirectOptions
|
||||
case C.TypeSOCKS:
|
||||
v = &h.SocksOptions
|
||||
case C.TypeHTTP:
|
||||
v = &h.HTTPOptions
|
||||
case C.TypeMixed:
|
||||
v = &h.MixedOptions
|
||||
case C.TypeShadowsocks:
|
||||
v = &h.ShadowsocksOptions
|
||||
case C.TypeVMess:
|
||||
v = &h.VMessOptions
|
||||
case C.TypeTrojan:
|
||||
v = &h.TrojanOptions
|
||||
case C.TypeNaive:
|
||||
v = &h.NaiveOptions
|
||||
case C.TypeHysteria:
|
||||
v = &h.HysteriaOptions
|
||||
case C.TypeShadowTLS:
|
||||
v = &h.ShadowTLSOptions
|
||||
case C.TypeVLESS:
|
||||
v = &h.VLESSOptions
|
||||
case C.TypeTUIC:
|
||||
v = &h.TUICOptions
|
||||
case C.TypeHysteria2:
|
||||
v = &h.Hysteria2Options
|
||||
case "":
|
||||
return E.New("missing inbound type")
|
||||
default:
|
||||
return E.New("unknown inbound type: ", h.Type)
|
||||
rawOptions, err := h.RawOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = UnmarshallExcluded(bytes, (*_Inbound)(h), v)
|
||||
err = UnmarshallExcluded(bytes, (*_Inbound)(h), rawOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -160,3 +135,16 @@ func (c *UDPTimeoutCompat) UnmarshalJSON(data []byte) error {
|
|||
}
|
||||
return json.Unmarshal(data, (*Duration)(c))
|
||||
}
|
||||
|
||||
type ListenOptionsWrapper interface {
|
||||
TakeListenOptions() ListenOptions
|
||||
ReplaceListenOptions(options ListenOptions)
|
||||
}
|
||||
|
||||
func (o *ListenOptions) TakeListenOptions() ListenOptions {
|
||||
return *o
|
||||
}
|
||||
|
||||
func (o *ListenOptions) ReplaceListenOptions(options ListenOptions) {
|
||||
*o = options
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import "github.com/sagernet/sing/common/auth"
|
|||
|
||||
type NaiveInboundOptions struct {
|
||||
ListenOptions
|
||||
Users []auth.User `json:"users,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Users []auth.User `json:"users,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
}
|
||||
|
|
|
@ -31,49 +31,59 @@ type _Outbound struct {
|
|||
|
||||
type Outbound _Outbound
|
||||
|
||||
func (h Outbound) MarshalJSON() ([]byte, error) {
|
||||
var v any
|
||||
func (h *Outbound) RawOptions() (any, error) {
|
||||
var rawOptionsPtr any
|
||||
switch h.Type {
|
||||
case C.TypeDirect:
|
||||
v = h.DirectOptions
|
||||
rawOptionsPtr = &h.DirectOptions
|
||||
case C.TypeBlock, C.TypeDNS:
|
||||
v = nil
|
||||
rawOptionsPtr = nil
|
||||
case C.TypeSOCKS:
|
||||
v = h.SocksOptions
|
||||
rawOptionsPtr = &h.SocksOptions
|
||||
case C.TypeHTTP:
|
||||
v = h.HTTPOptions
|
||||
rawOptionsPtr = &h.HTTPOptions
|
||||
case C.TypeShadowsocks:
|
||||
v = h.ShadowsocksOptions
|
||||
rawOptionsPtr = &h.ShadowsocksOptions
|
||||
case C.TypeVMess:
|
||||
v = h.VMessOptions
|
||||
rawOptionsPtr = &h.VMessOptions
|
||||
case C.TypeTrojan:
|
||||
v = h.TrojanOptions
|
||||
rawOptionsPtr = &h.TrojanOptions
|
||||
case C.TypeWireGuard:
|
||||
v = h.WireGuardOptions
|
||||
rawOptionsPtr = &h.WireGuardOptions
|
||||
case C.TypeHysteria:
|
||||
v = h.HysteriaOptions
|
||||
rawOptionsPtr = &h.HysteriaOptions
|
||||
case C.TypeTor:
|
||||
v = h.TorOptions
|
||||
rawOptionsPtr = &h.TorOptions
|
||||
case C.TypeSSH:
|
||||
v = h.SSHOptions
|
||||
rawOptionsPtr = &h.SSHOptions
|
||||
case C.TypeShadowTLS:
|
||||
v = h.ShadowTLSOptions
|
||||
rawOptionsPtr = &h.ShadowTLSOptions
|
||||
case C.TypeShadowsocksR:
|
||||
v = h.ShadowsocksROptions
|
||||
rawOptionsPtr = &h.ShadowsocksROptions
|
||||
case C.TypeVLESS:
|
||||
v = h.VLESSOptions
|
||||
rawOptionsPtr = &h.VLESSOptions
|
||||
case C.TypeTUIC:
|
||||
v = h.TUICOptions
|
||||
rawOptionsPtr = &h.TUICOptions
|
||||
case C.TypeHysteria2:
|
||||
v = h.Hysteria2Options
|
||||
rawOptionsPtr = &h.Hysteria2Options
|
||||
case C.TypeSelector:
|
||||
v = h.SelectorOptions
|
||||
rawOptionsPtr = &h.SelectorOptions
|
||||
case C.TypeURLTest:
|
||||
v = h.URLTestOptions
|
||||
rawOptionsPtr = &h.URLTestOptions
|
||||
case "":
|
||||
return nil, E.New("missing outbound type")
|
||||
default:
|
||||
return nil, E.New("unknown outbound type: ", h.Type)
|
||||
}
|
||||
return MarshallObjects((_Outbound)(h), v)
|
||||
return rawOptionsPtr, nil
|
||||
}
|
||||
|
||||
func (h *Outbound) MarshalJSON() ([]byte, error) {
|
||||
rawOptions, err := h.RawOptions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return MarshallObjects((*_Outbound)(h), rawOptions)
|
||||
}
|
||||
|
||||
func (h *Outbound) UnmarshalJSON(bytes []byte) error {
|
||||
|
@ -81,56 +91,22 @@ func (h *Outbound) UnmarshalJSON(bytes []byte) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var v any
|
||||
switch h.Type {
|
||||
case C.TypeDirect:
|
||||
v = &h.DirectOptions
|
||||
case C.TypeBlock, C.TypeDNS:
|
||||
v = nil
|
||||
case C.TypeSOCKS:
|
||||
v = &h.SocksOptions
|
||||
case C.TypeHTTP:
|
||||
v = &h.HTTPOptions
|
||||
case C.TypeShadowsocks:
|
||||
v = &h.ShadowsocksOptions
|
||||
case C.TypeVMess:
|
||||
v = &h.VMessOptions
|
||||
case C.TypeTrojan:
|
||||
v = &h.TrojanOptions
|
||||
case C.TypeWireGuard:
|
||||
v = &h.WireGuardOptions
|
||||
case C.TypeHysteria:
|
||||
v = &h.HysteriaOptions
|
||||
case C.TypeTor:
|
||||
v = &h.TorOptions
|
||||
case C.TypeSSH:
|
||||
v = &h.SSHOptions
|
||||
case C.TypeShadowTLS:
|
||||
v = &h.ShadowTLSOptions
|
||||
case C.TypeShadowsocksR:
|
||||
v = &h.ShadowsocksROptions
|
||||
case C.TypeVLESS:
|
||||
v = &h.VLESSOptions
|
||||
case C.TypeTUIC:
|
||||
v = &h.TUICOptions
|
||||
case C.TypeHysteria2:
|
||||
v = &h.Hysteria2Options
|
||||
case C.TypeSelector:
|
||||
v = &h.SelectorOptions
|
||||
case C.TypeURLTest:
|
||||
v = &h.URLTestOptions
|
||||
case "":
|
||||
return E.New("missing outbound type")
|
||||
default:
|
||||
return E.New("unknown outbound type: ", h.Type)
|
||||
rawOptions, err := h.RawOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = UnmarshallExcluded(bytes, (*_Outbound)(h), v)
|
||||
err = UnmarshallExcluded(bytes, (*_Outbound)(h), rawOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DialerOptionsWrapper interface {
|
||||
TakeDialerOptions() DialerOptions
|
||||
ReplaceDialerOptions(options DialerOptions)
|
||||
}
|
||||
|
||||
type DialerOptions struct {
|
||||
Detour string `json:"detour,omitempty"`
|
||||
BindInterface string `json:"bind_interface,omitempty"`
|
||||
|
@ -148,6 +124,19 @@ type DialerOptions struct {
|
|||
FallbackDelay Duration `json:"fallback_delay,omitempty"`
|
||||
}
|
||||
|
||||
func (o *DialerOptions) TakeDialerOptions() DialerOptions {
|
||||
return *o
|
||||
}
|
||||
|
||||
func (o *DialerOptions) ReplaceDialerOptions(options DialerOptions) {
|
||||
*o = options
|
||||
}
|
||||
|
||||
type ServerOptionsWrapper interface {
|
||||
TakeServerOptions() ServerOptions
|
||||
ReplaceServerOptions(options ServerOptions)
|
||||
}
|
||||
|
||||
type ServerOptions struct {
|
||||
Server string `json:"server"`
|
||||
ServerPort uint16 `json:"server_port"`
|
||||
|
@ -156,3 +145,11 @@ type ServerOptions struct {
|
|||
func (o ServerOptions) Build() M.Socksaddr {
|
||||
return M.ParseSocksaddrHostPort(o.Server, o.ServerPort)
|
||||
}
|
||||
|
||||
func (o *ServerOptions) TakeServerOptions() ServerOptions {
|
||||
return *o
|
||||
}
|
||||
|
||||
func (o *ServerOptions) ReplaceServerOptions(options ServerOptions) {
|
||||
*o = options
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ type ShadowTLSHandshakeOptions struct {
|
|||
type ShadowTLSOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
Version int `json:"version,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
Version int `json:"version,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ type SocksInboundOptions struct {
|
|||
|
||||
type HTTPMixedInboundOptions struct {
|
||||
ListenOptions
|
||||
Users []auth.User `json:"users,omitempty"`
|
||||
SetSystemProxy bool `json:"set_system_proxy,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Users []auth.User `json:"users,omitempty"`
|
||||
SetSystemProxy bool `json:"set_system_proxy,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
}
|
||||
|
||||
type SocksOutboundOptions struct {
|
||||
|
@ -27,9 +27,9 @@ type SocksOutboundOptions struct {
|
|||
type HTTPOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
Username string `json:"username,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Headers HTTPHeader `json:"headers,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
Path string `json:"path,omitempty"`
|
||||
Headers HTTPHeader `json:"headers,omitempty"`
|
||||
}
|
||||
|
|
|
@ -17,6 +17,23 @@ type InboundTLSOptions struct {
|
|||
Reality *InboundRealityOptions `json:"reality,omitempty"`
|
||||
}
|
||||
|
||||
type InboundTLSOptionsContainer struct {
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
}
|
||||
|
||||
type InboundTLSOptionsWrapper interface {
|
||||
TakeInboundTLSOptions() *InboundTLSOptions
|
||||
ReplaceInboundTLSOptions(options *InboundTLSOptions)
|
||||
}
|
||||
|
||||
func (o *InboundTLSOptionsContainer) TakeInboundTLSOptions() *InboundTLSOptions {
|
||||
return o.TLS
|
||||
}
|
||||
|
||||
func (o *InboundTLSOptionsContainer) ReplaceInboundTLSOptions(options *InboundTLSOptions) {
|
||||
o.TLS = options
|
||||
}
|
||||
|
||||
type OutboundTLSOptions struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
DisableSNI bool `json:"disable_sni,omitempty"`
|
||||
|
@ -33,6 +50,23 @@ type OutboundTLSOptions struct {
|
|||
Reality *OutboundRealityOptions `json:"reality,omitempty"`
|
||||
}
|
||||
|
||||
type OutboundTLSOptionsContainer struct {
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
}
|
||||
|
||||
type OutboundTLSOptionsWrapper interface {
|
||||
TakeOutboundTLSOptions() *OutboundTLSOptions
|
||||
ReplaceOutboundTLSOptions(options *OutboundTLSOptions)
|
||||
}
|
||||
|
||||
func (o *OutboundTLSOptionsContainer) TakeOutboundTLSOptions() *OutboundTLSOptions {
|
||||
return o.TLS
|
||||
}
|
||||
|
||||
func (o *OutboundTLSOptionsContainer) ReplaceOutboundTLSOptions(options *OutboundTLSOptions) {
|
||||
o.TLS = options
|
||||
}
|
||||
|
||||
type InboundRealityOptions struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Handshake InboundRealityHandshakeOptions `json:"handshake,omitempty"`
|
||||
|
|
|
@ -2,8 +2,8 @@ package option
|
|||
|
||||
type TrojanInboundOptions struct {
|
||||
ListenOptions
|
||||
Users []TrojanUser `json:"users,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Users []TrojanUser `json:"users,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
Fallback *ServerOptions `json:"fallback,omitempty"`
|
||||
FallbackForALPN map[string]*ServerOptions `json:"fallback_for_alpn,omitempty"`
|
||||
Multiplex *InboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
|
@ -18,9 +18,9 @@ type TrojanUser struct {
|
|||
type TrojanOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
Password string `json:"password"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
Password string `json:"password"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
Multiplex *OutboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@ package option
|
|||
|
||||
type TUICInboundOptions struct {
|
||||
ListenOptions
|
||||
Users []TUICUser `json:"users,omitempty"`
|
||||
CongestionControl string `json:"congestion_control,omitempty"`
|
||||
AuthTimeout Duration `json:"auth_timeout,omitempty"`
|
||||
ZeroRTTHandshake bool `json:"zero_rtt_handshake,omitempty"`
|
||||
Heartbeat Duration `json:"heartbeat,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Users []TUICUser `json:"users,omitempty"`
|
||||
CongestionControl string `json:"congestion_control,omitempty"`
|
||||
AuthTimeout Duration `json:"auth_timeout,omitempty"`
|
||||
ZeroRTTHandshake bool `json:"zero_rtt_handshake,omitempty"`
|
||||
Heartbeat Duration `json:"heartbeat,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
}
|
||||
|
||||
type TUICUser struct {
|
||||
|
@ -19,13 +19,13 @@ type TUICUser struct {
|
|||
type TUICOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
CongestionControl string `json:"congestion_control,omitempty"`
|
||||
UDPRelayMode string `json:"udp_relay_mode,omitempty"`
|
||||
UDPOverStream bool `json:"udp_over_stream,omitempty"`
|
||||
ZeroRTTHandshake bool `json:"zero_rtt_handshake,omitempty"`
|
||||
Heartbeat Duration `json:"heartbeat,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
CongestionControl string `json:"congestion_control,omitempty"`
|
||||
UDPRelayMode string `json:"udp_relay_mode,omitempty"`
|
||||
UDPOverStream bool `json:"udp_over_stream,omitempty"`
|
||||
ZeroRTTHandshake bool `json:"zero_rtt_handshake,omitempty"`
|
||||
Heartbeat Duration `json:"heartbeat,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ package option
|
|||
|
||||
type VLESSInboundOptions struct {
|
||||
ListenOptions
|
||||
Users []VLESSUser `json:"users,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Users []VLESSUser `json:"users,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
Multiplex *InboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ type VLESSUser struct {
|
|||
type VLESSOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
UUID string `json:"uuid"`
|
||||
Flow string `json:"flow,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
UUID string `json:"uuid"`
|
||||
Flow string `json:"flow,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
Multiplex *OutboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||
PacketEncoding *string `json:"packet_encoding,omitempty"`
|
||||
|
|
|
@ -2,8 +2,8 @@ package option
|
|||
|
||||
type VMessInboundOptions struct {
|
||||
ListenOptions
|
||||
Users []VMessUser `json:"users,omitempty"`
|
||||
TLS *InboundTLSOptions `json:"tls,omitempty"`
|
||||
Users []VMessUser `json:"users,omitempty"`
|
||||
InboundTLSOptionsContainer
|
||||
Multiplex *InboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||
}
|
||||
|
@ -17,14 +17,14 @@ type VMessUser struct {
|
|||
type VMessOutboundOptions struct {
|
||||
DialerOptions
|
||||
ServerOptions
|
||||
UUID string `json:"uuid"`
|
||||
Security string `json:"security"`
|
||||
AlterId int `json:"alter_id,omitempty"`
|
||||
GlobalPadding bool `json:"global_padding,omitempty"`
|
||||
AuthenticatedLength bool `json:"authenticated_length,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
TLS *OutboundTLSOptions `json:"tls,omitempty"`
|
||||
PacketEncoding string `json:"packet_encoding,omitempty"`
|
||||
Multiplex *OutboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||
UUID string `json:"uuid"`
|
||||
Security string `json:"security"`
|
||||
AlterId int `json:"alter_id,omitempty"`
|
||||
GlobalPadding bool `json:"global_padding,omitempty"`
|
||||
AuthenticatedLength bool `json:"authenticated_length,omitempty"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
OutboundTLSOptionsContainer
|
||||
PacketEncoding string `json:"packet_encoding,omitempty"`
|
||||
Multiplex *OutboundMultiplexOptions `json:"multiplex,omitempty"`
|
||||
Transport *V2RayTransportOptions `json:"transport,omitempty"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue