mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
test: add anytls
This commit is contained in:
@@ -354,6 +354,15 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
TLS: &tls,
|
||||
},
|
||||
}
|
||||
case "anytls":
|
||||
in.Type = "anytls"
|
||||
in.Options = &option.AnyTLSInboundOptions{
|
||||
ListenOptions: listen,
|
||||
PaddingScheme: info.AnyTls.PaddingScheme,
|
||||
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
||||
TLS: &tls,
|
||||
},
|
||||
}
|
||||
case "hysteria":
|
||||
in.Type = "hysteria"
|
||||
in.Options = &option.HysteriaInboundOptions{
|
||||
|
||||
@@ -37,7 +37,7 @@ func init() {
|
||||
|
||||
func New(c *conf.CoreConfig) (vCore.Core, error) {
|
||||
ctx := context.Background()
|
||||
ctx = box.Context(ctx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry(), include.DNSTransportRegistry())
|
||||
ctx = box.Context(ctx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry(), include.DNSTransportRegistry(), include.ServiceRegistry())
|
||||
options := option.Options{}
|
||||
if len(c.SingConfig.OriginalPath) != 0 {
|
||||
data, err := os.ReadFile(c.SingConfig.OriginalPath)
|
||||
@@ -72,7 +72,7 @@ func New(c *conf.CoreConfig) (vCore.Core, error) {
|
||||
return nil, err
|
||||
}
|
||||
hs := NewHookServer()
|
||||
b.Router().SetTracker(hs)
|
||||
b.Router().AppendTracker(hs)
|
||||
return &Sing{
|
||||
ctx: b.Router().GetCtx(),
|
||||
box: b,
|
||||
@@ -97,6 +97,7 @@ func (b *Sing) Protocols() []string {
|
||||
"shadowsocks",
|
||||
"trojan",
|
||||
"tuic",
|
||||
"anytls",
|
||||
"hysteria",
|
||||
"hysteria2",
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/InazumaV/V2bX/common/counter"
|
||||
"github.com/InazumaV/V2bX/core"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing-box/protocol/anytls"
|
||||
"github.com/sagernet/sing-box/protocol/hysteria"
|
||||
"github.com/sagernet/sing-box/protocol/hysteria2"
|
||||
"github.com/sagernet/sing-box/protocol/shadowsocks"
|
||||
@@ -99,6 +100,16 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
||||
id[i] = p.Users[i].Id
|
||||
}
|
||||
err = in.(*hysteria2.Inbound).AddUsers(us, id)
|
||||
case "anytls":
|
||||
us := make([]option.AnyTLSUser, len(p.Users))
|
||||
for i := range p.Users {
|
||||
us[i] = option.AnyTLSUser{
|
||||
Name: p.Users[i].Uuid,
|
||||
Password: p.Users[i].Uuid,
|
||||
}
|
||||
}
|
||||
ids := make([]int, len(p.Users))
|
||||
err = in.(*anytls.Inbound).AddUsers(us, ids)
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -141,6 +152,8 @@ func (b *Sing) DelUsers(users []panel.UserInfo, tag string, info *panel.NodeInfo
|
||||
del = i.(*hysteria.Inbound)
|
||||
case "hysteria2":
|
||||
del = i.(*hysteria2.Inbound)
|
||||
case "anytls":
|
||||
del = i.(*anytls.Inbound)
|
||||
}
|
||||
} else {
|
||||
return errors.New("the inbound not found")
|
||||
|
||||
Reference in New Issue
Block a user