mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
Merge pull request #30 from KorenKrita/dev_new
add sing mux config support
This commit is contained in:
commit
a0de94efff
14
conf/sing.go
14
conf/sing.go
@ -40,6 +40,7 @@ type SingOptions struct {
|
|||||||
DomainStrategy option.DomainStrategy `json:"DomainStrategy"`
|
DomainStrategy option.DomainStrategy `json:"DomainStrategy"`
|
||||||
SniffOverrideDestination bool `json:"SniffOverrideDestination"`
|
SniffOverrideDestination bool `json:"SniffOverrideDestination"`
|
||||||
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
|
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
|
||||||
|
Multiplex *MultiplexConfig `json:"MultiplexConfig"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SingNtpConfig struct {
|
type SingNtpConfig struct {
|
||||||
@ -59,6 +60,18 @@ type FallBack struct {
|
|||||||
ServerPort string `json:"ServerPort"`
|
ServerPort string `json:"ServerPort"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MultiplexConfig struct {
|
||||||
|
Enabled bool `json:"Enable"`
|
||||||
|
Padding bool `json:"Padding"`
|
||||||
|
Brutal BrutalOptions `json:"Brutal"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BrutalOptions struct {
|
||||||
|
Enabled bool `json:"Enable"`
|
||||||
|
UpMbps int `json:"UpMbps"`
|
||||||
|
DownMbps int `json:"DownMbps"`
|
||||||
|
}
|
||||||
|
|
||||||
func NewSingOptions() *SingOptions {
|
func NewSingOptions() *SingOptions {
|
||||||
return &SingOptions{
|
return &SingOptions{
|
||||||
EnableDNS: false,
|
EnableDNS: false,
|
||||||
@ -67,5 +80,6 @@ func NewSingOptions() *SingOptions {
|
|||||||
SniffEnabled: true,
|
SniffEnabled: true,
|
||||||
SniffOverrideDestination: true,
|
SniffOverrideDestination: true,
|
||||||
FallBackConfigs: &FallBackConfigForSing{},
|
FallBackConfigs: &FallBackConfigForSing{},
|
||||||
|
Multiplex: &MultiplexConfig{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,19 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
DomainStrategy: domainStrategy,
|
DomainStrategy: domainStrategy,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
var multiplex *option.InboundMultiplexOptions
|
||||||
|
if c.SingOptions.Multiplex != nil {
|
||||||
|
multiplexOption := option.InboundMultiplexOptions{
|
||||||
|
Enabled: c.SingOptions.Multiplex.Enabled,
|
||||||
|
Padding: c.SingOptions.Multiplex.Padding,
|
||||||
|
Brutal: &option.BrutalOptions{
|
||||||
|
Enabled: c.SingOptions.Multiplex.Brutal.Enabled,
|
||||||
|
UpMbps: c.SingOptions.Multiplex.Brutal.UpMbps,
|
||||||
|
DownMbps: c.SingOptions.Multiplex.Brutal.DownMbps,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
multiplex = &multiplexOption
|
||||||
|
}
|
||||||
var tls option.InboundTLSOptions
|
var tls option.InboundTLSOptions
|
||||||
switch info.Security {
|
switch info.Security {
|
||||||
case panel.Tls:
|
case panel.Tls:
|
||||||
@ -210,6 +223,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
Transport: &t,
|
Transport: &t,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
in.Type = "vmess"
|
in.Type = "vmess"
|
||||||
@ -219,6 +233,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
Transport: &t,
|
Transport: &t,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
@ -236,6 +251,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
in.ShadowsocksOptions = option.ShadowsocksInboundOptions{
|
in.ShadowsocksOptions = option.ShadowsocksInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
Method: n.Cipher,
|
Method: n.Cipher,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
p := make([]byte, keyLength)
|
p := make([]byte, keyLength)
|
||||||
_, _ = rand.Read(p)
|
_, _ = rand.Read(p)
|
||||||
@ -308,6 +324,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
Transport: &t,
|
Transport: &t,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
if c.SingOptions.FallBackConfigs != nil {
|
if c.SingOptions.FallBackConfigs != nil {
|
||||||
// fallback handling
|
// fallback handling
|
||||||
|
Loading…
Reference in New Issue
Block a user