Add naive inbound and test

This commit is contained in:
世界
2022-08-10 20:19:16 +08:00
parent ccdfab378a
commit b79b19c470
23 changed files with 709 additions and 87 deletions

View File

@@ -19,6 +19,7 @@ type _Inbound struct {
ShadowsocksOptions ShadowsocksInboundOptions `json:"-"`
VMessOptions VMessInboundOptions `json:"-"`
TrojanOptions TrojanInboundOptions `json:"-"`
NaiveOptions NaiveInboundOptions `json:"-"`
}
type Inbound _Inbound
@@ -46,6 +47,8 @@ func (h Inbound) MarshalJSON() ([]byte, error) {
v = h.VMessOptions
case C.TypeTrojan:
v = h.TrojanOptions
case C.TypeNaive:
v = h.NaiveOptions
default:
return nil, E.New("unknown inbound type: ", h.Type)
}
@@ -79,6 +82,8 @@ func (h *Inbound) UnmarshalJSON(bytes []byte) error {
v = &h.VMessOptions
case C.TypeTrojan:
v = &h.TrojanOptions
case C.TypeNaive:
v = &h.NaiveOptions
default:
return E.New("unknown inbound type: ", h.Type)
}

10
option/naive.go Normal file
View File

@@ -0,0 +1,10 @@
package option
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"`
}