mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
update Xray-core 1.8.18
This commit is contained in:
parent
b96545649b
commit
4d82eff518
@ -40,6 +40,15 @@ type WsNetworkConfig struct {
|
|||||||
Headers map[string]string `json:"headers"`
|
Headers map[string]string `json:"headers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GrpcNetworkConfig struct {
|
||||||
|
ServiceName string `json:"serviceName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HttpupgradeNetworkConfig struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
Host string `json:"host"`
|
||||||
|
}
|
||||||
|
|
||||||
func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (option.Inbound, error) {
|
func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (option.Inbound, error) {
|
||||||
addr, err := netip.ParseAddr(c.ListenIP)
|
addr, err := netip.ParseAddr(c.ListenIP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -170,12 +179,28 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
Headers: headers,
|
Headers: headers,
|
||||||
}
|
}
|
||||||
case "grpc":
|
case "grpc":
|
||||||
|
network := GrpcNetworkConfig{}
|
||||||
if len(n.NetworkSettings) != 0 {
|
if len(n.NetworkSettings) != 0 {
|
||||||
err := json.Unmarshal(n.NetworkSettings, &t.GRPCOptions)
|
err := json.Unmarshal(n.NetworkSettings, &network)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
|
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
t.GRPCOptions = option.V2RayGRPCOptions{
|
||||||
|
ServiceName: network.ServiceName,
|
||||||
|
}
|
||||||
|
case "httpupgrade":
|
||||||
|
network := HttpupgradeNetworkConfig{}
|
||||||
|
if len(n.NetworkSettings) != 0 {
|
||||||
|
err := json.Unmarshal(n.NetworkSettings, &network)
|
||||||
|
if err != nil {
|
||||||
|
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.HTTPUpgradeOptions = option.V2RayHTTPUpgradeOptions{
|
||||||
|
Path: network.Path,
|
||||||
|
Host: network.Host,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if info.Type == "vless" {
|
if info.Type == "vless" {
|
||||||
in.Type = "vless"
|
in.Type = "vless"
|
||||||
@ -203,7 +228,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
switch n.Cipher {
|
switch n.Cipher {
|
||||||
case "2022-blake3-aes-128-gcm":
|
case "2022-blake3-aes-128-gcm":
|
||||||
keyLength = 16
|
keyLength = 16
|
||||||
case "2022-blake3-aes-256-gcm":
|
case "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305":
|
||||||
keyLength = 32
|
keyLength = 32
|
||||||
default:
|
default:
|
||||||
keyLength = 16
|
keyLength = 16
|
||||||
@ -263,12 +288,16 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
Headers: headers,
|
Headers: headers,
|
||||||
}
|
}
|
||||||
case "grpc":
|
case "grpc":
|
||||||
|
network := GrpcNetworkConfig{}
|
||||||
if len(n.NetworkSettings) != 0 {
|
if len(n.NetworkSettings) != 0 {
|
||||||
err := json.Unmarshal(n.NetworkSettings, &t.GRPCOptions)
|
err := json.Unmarshal(n.NetworkSettings, &network)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
|
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
t.GRPCOptions = option.V2RayGRPCOptions{
|
||||||
|
ServiceName: network.ServiceName,
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
t.Type = ""
|
t.Type = ""
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,26 @@ func buildV2ray(config *conf.Options, nodeInfo *panel.NodeInfo, inbound *coreCon
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
}
|
}
|
||||||
|
case "http":
|
||||||
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.HTTPSettings)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
|
}
|
||||||
|
case "quic":
|
||||||
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.QUICSettings)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
|
}
|
||||||
|
case "httpupgrade":
|
||||||
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.HTTPUPGRADESettings)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
|
}
|
||||||
|
case "splithttp":
|
||||||
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.SplitHTTPSettings)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return errors.New("the network type is not vail")
|
return errors.New("the network type is not vail")
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -19,7 +19,7 @@ require (
|
|||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
github.com/spf13/cobra v1.8.0
|
github.com/spf13/cobra v1.8.0
|
||||||
github.com/spf13/viper v1.15.0
|
github.com/spf13/viper v1.15.0
|
||||||
github.com/xtls/xray-core v1.8.17
|
github.com/xtls/xray-core v1.8.18
|
||||||
go.uber.org/zap v1.27.0
|
go.uber.org/zap v1.27.0
|
||||||
golang.org/x/crypto v0.25.0
|
golang.org/x/crypto v0.25.0
|
||||||
golang.org/x/sys v0.22.0
|
golang.org/x/sys v0.22.0
|
||||||
|
4
go.sum
4
go.sum
@ -949,8 +949,8 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ
|
|||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d h1:+B97uD9uHLgAAulhigmys4BVwZZypzK7gPN3WtpgRJg=
|
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d h1:+B97uD9uHLgAAulhigmys4BVwZZypzK7gPN3WtpgRJg=
|
||||||
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE=
|
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE=
|
||||||
github.com/xtls/xray-core v1.8.17 h1:T+A/hkBB33P0sEGXDiuKrQMZUOYxbZ84JlsYfyRiK8w=
|
github.com/xtls/xray-core v1.8.18 h1:o4SnyQ78vh5o9dp3NoIKwEeN7AUWlEGawQ5PkogTC1w=
|
||||||
github.com/xtls/xray-core v1.8.17/go.mod h1:qEVGJD2suPN7EArG3r5EX6pYGV0QLiSRTlDMn0paJkc=
|
github.com/xtls/xray-core v1.8.18/go.mod h1:z7D4GwOXWwque0B5DJ+/+eGEVE4V5kFRhl0qbecMeY0=
|
||||||
github.com/yandex-cloud/go-genproto v0.0.0-20240318083951-4fe6125f286e h1:jLIqA7M9qY31g/Nw/5htVD0DFbxmLnlFZcHKJiG3osI=
|
github.com/yandex-cloud/go-genproto v0.0.0-20240318083951-4fe6125f286e h1:jLIqA7M9qY31g/Nw/5htVD0DFbxmLnlFZcHKJiG3osI=
|
||||||
github.com/yandex-cloud/go-genproto v0.0.0-20240318083951-4fe6125f286e/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE=
|
github.com/yandex-cloud/go-genproto v0.0.0-20240318083951-4fe6125f286e/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE=
|
||||||
github.com/yandex-cloud/go-sdk v0.0.0-20240318084659-dfa50323a0b4 h1:wtzLQJmghkSUb1YkeFphIh7ST7NNVDaVOJZSAJcjMdw=
|
github.com/yandex-cloud/go-sdk v0.0.0-20240318084659-dfa50323a0b4 h1:wtzLQJmghkSUb1YkeFphIh7ST7NNVDaVOJZSAJcjMdw=
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/InazumaV/V2bX/api/panel"
|
"github.com/InazumaV/V2bX/api/panel"
|
||||||
@ -60,7 +59,7 @@ func (c *Controller) reportUserTrafficTask() (err error) {
|
|||||||
data := make(map[int][]string)
|
data := make(map[int][]string)
|
||||||
for _, onlineuser := range result {
|
for _, onlineuser := range result {
|
||||||
// json structure: { UID1:["ip1","ip2"],UID2:["ip3","ip4"] }
|
// json structure: { UID1:["ip1","ip2"],UID2:["ip3","ip4"] }
|
||||||
data[onlineuser.UID] = append(data[onlineuser.UID], fmt.Sprintf("%s_%d", onlineuser.IP, c.info.Id))
|
data[onlineuser.UID] = append(data[onlineuser.UID], onlineuser.IP)
|
||||||
if _, ok := reportOnline[onlineuser.UID]; ok {
|
if _, ok := reportOnline[onlineuser.UID]; ok {
|
||||||
reportOnline[onlineuser.UID]++
|
reportOnline[onlineuser.UID]++
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user