mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-07 03:34:57 +03:00
Add multiplexer
This commit is contained in:
@@ -98,3 +98,10 @@ type ServerOptions struct {
|
||||
func (o ServerOptions) Build() M.Socksaddr {
|
||||
return M.ParseSocksaddrHostPort(o.Server, o.ServerPort)
|
||||
}
|
||||
|
||||
type MultiplexOptions struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
MaxConnections int `json:"max_connections,omitempty"`
|
||||
MinStreams int `json:"min_streams,omitempty"`
|
||||
MaxStreams int `json:"max_streams,omitempty"`
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ type ShadowsocksDestination struct {
|
||||
type ShadowsocksOutboundOptions struct {
|
||||
OutboundDialerOptions
|
||||
ServerOptions
|
||||
Method string `json:"method"`
|
||||
Password string `json:"password"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
Method string `json:"method"`
|
||||
Password string `json:"password"`
|
||||
Network NetworkList `json:"network,omitempty"`
|
||||
Multiplex *MultiplexOptions `json:"multiplex,omitempty"`
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/sagernet/sing-box/common/json"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-dns"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
)
|
||||
|
||||
type ListenAddress netip.Addr
|
||||
@@ -50,7 +50,7 @@ func (v *NetworkList) UnmarshalJSON(content []byte) error {
|
||||
}
|
||||
for _, networkName := range networkList {
|
||||
switch networkName {
|
||||
case C.NetworkTCP, C.NetworkUDP:
|
||||
case N.NetworkTCP, N.NetworkUDP:
|
||||
break
|
||||
default:
|
||||
return E.New("unknown network: " + networkName)
|
||||
@@ -62,7 +62,7 @@ func (v *NetworkList) UnmarshalJSON(content []byte) error {
|
||||
|
||||
func (v NetworkList) Build() []string {
|
||||
if v == "" {
|
||||
return []string{C.NetworkTCP, C.NetworkUDP}
|
||||
return []string{N.NetworkTCP, N.NetworkUDP}
|
||||
}
|
||||
return strings.Split(string(v), "\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user