修正singbox内核hy2用户列表问题

This commit is contained in:
wyx2685 2024-02-21 13:02:13 +09:00
parent 55b20f5550
commit 96b457d679
No known key found for this signature in database
GPG Key ID: 8827A30FF1DB1379
3 changed files with 8 additions and 6 deletions

View File

@ -63,20 +63,22 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
us := make([]option.HysteriaUser, len(p.Users)) us := make([]option.HysteriaUser, len(p.Users))
for i := range p.Users { for i := range p.Users {
us[i] = option.HysteriaUser{ us[i] = option.HysteriaUser{
Name: string(p.Users[i].Id), Name: p.Users[i].Uuid,
AuthString: p.Users[i].Uuid, AuthString: p.Users[i].Uuid,
} }
} }
err = b.inbounds[p.Tag].(*inbound.Hysteria).AddUsers(us) err = b.inbounds[p.Tag].(*inbound.Hysteria).AddUsers(us)
case "hysteria2": case "hysteria2":
us := make([]option.Hysteria2User, len(p.Users)) us := make([]option.Hysteria2User, len(p.Users))
id := make([]int, len(p.Users))
for i := range p.Users { for i := range p.Users {
us[i] = option.Hysteria2User{ us[i] = option.Hysteria2User{
Name: string(p.Users[i].Id), Name: p.Users[i].Uuid,
Password: p.Users[i].Uuid, Password: p.Users[i].Uuid,
} }
id[i] = p.Users[i].Id
} }
err = b.inbounds[p.Tag].(*inbound.Hysteria2).AddUsers(us) err = b.inbounds[p.Tag].(*inbound.Hysteria2).AddUsers(us, id)
} }
if err != nil { if err != nil {
return 0, err return 0, err

2
go.mod
View File

@ -231,4 +231,4 @@ require (
) )
//github.com/apernet/hysteria/core v1.3.5-0.20240201034858-bb99579bb92c => /root/hysteria/core //github.com/apernet/hysteria/core v1.3.5-0.20240201034858-bb99579bb92c => /root/hysteria/core
replace github.com/sagernet/sing-box v1.9.0 => github.com/wyx2685/sing-box_mod v0.0.3 replace github.com/sagernet/sing-box v1.9.0 => github.com/wyx2685/sing-box_mod v0.0.4

4
go.sum
View File

@ -800,8 +800,8 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs= github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs=
github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI= github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI=
github.com/wyx2685/sing-box_mod v0.0.3 h1:UYLZZzoAzdai+ehsc2kSQJq9p9WQ5wVaZWuZtPddLOQ= github.com/wyx2685/sing-box_mod v0.0.4 h1:fEZnkrtUwqJS/6M3drSdv9RXyRvhnuD2UV6rK5U6rLA=
github.com/wyx2685/sing-box_mod v0.0.3/go.mod h1:Q5C14BKQoRzkJ+JPGuMdffHZEoOrlU1zsiBkTtfPoA0= github.com/wyx2685/sing-box_mod v0.0.4/go.mod h1:Q5C14BKQoRzkJ+JPGuMdffHZEoOrlU1zsiBkTtfPoA0=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=