mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
commit
e301f9c68c
@ -99,22 +99,29 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
}
|
}
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
in.Type = "shadowsocks"
|
in.Type = "shadowsocks"
|
||||||
p := make([]byte, 32)
|
var keyLength int
|
||||||
_, _ = rand.Read(p)
|
switch info.Cipher {
|
||||||
randomPasswd := hex.EncodeToString(p)
|
case "2022-blake3-aes-128-gcm":
|
||||||
if strings.Contains(info.Cipher, "2022") {
|
keyLength = 16
|
||||||
randomPasswd = base64.StdEncoding.EncodeToString([]byte(randomPasswd))
|
case "2022-blake3-aes-256-gcm":
|
||||||
|
keyLength = 32
|
||||||
|
default:
|
||||||
|
keyLength = 8
|
||||||
}
|
}
|
||||||
in.ShadowsocksOptions = option.ShadowsocksInboundOptions{
|
in.ShadowsocksOptions = option.ShadowsocksInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
Method: info.Cipher,
|
Method: info.Cipher,
|
||||||
Password: info.ServerKey,
|
|
||||||
Users: []option.ShadowsocksUser{
|
|
||||||
{
|
|
||||||
Password: randomPasswd,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
p := make([]byte, keyLength)
|
||||||
|
_, _ = rand.Read(p)
|
||||||
|
randomPasswd := hex.EncodeToString(p)
|
||||||
|
if strings.Contains(info.Cipher, "2022") {
|
||||||
|
randomPasswd = base64.StdEncoding.EncodeToString([]byte(randomPasswd))
|
||||||
|
in.ShadowsocksOptions.Password = randomPasswd
|
||||||
|
}
|
||||||
|
in.ShadowsocksOptions.Users = []option.ShadowsocksUser{{
|
||||||
|
Password: randomPasswd,
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
return in, nil
|
return in, nil
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func (b *Box) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Box) GetUserTraffic(tag, uuid string, reset bool) (up int64, down int64) {
|
func (b *Box) GetUserTraffic(tag, uuid string, reset bool) (up int64, down int64) {
|
||||||
if v, ok := b.hookServer.Hooker().counter.Load(tag); ok {
|
if v, ok := b.hookServer.counter.Load(tag); ok {
|
||||||
c := v.(*counter.TrafficCounter)
|
c := v.(*counter.TrafficCounter)
|
||||||
up = c.GetUpCount(uuid)
|
up = c.GetUpCount(uuid)
|
||||||
down = c.GetDownCount(uuid)
|
down = c.GetDownCount(uuid)
|
||||||
|
Loading…
Reference in New Issue
Block a user