Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
yuzuki999 2023-07-13 01:19:21 +08:00
commit f0ad893d9a
2 changed files with 23 additions and 22 deletions

View File

@ -6,6 +6,7 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"github.com/Yuzuki616/V2bX/api/panel" "github.com/Yuzuki616/V2bX/api/panel"
"github.com/Yuzuki616/V2bX/conf" "github.com/Yuzuki616/V2bX/conf"
"github.com/goccy/go-json" "github.com/goccy/go-json"
@ -52,16 +53,16 @@ func BuildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s
in.SniffingConfig = sniffingConfig in.SniffingConfig = sniffingConfig
if *in.StreamSetting.Network == "tcp" { if *in.StreamSetting.Network == "tcp" {
if in.StreamSetting.TCPSettings != nil { if in.StreamSetting.TCPSettings != nil {
in.StreamSetting.TCPSettings.AcceptProxyProtocol = config.EnableProxyProtocol in.StreamSetting.TCPSettings.AcceptProxyProtocol = config.XrayOptions.EnableProxyProtocol
} else { } else {
tcpSetting := &coreConf.TCPConfig{ tcpSetting := &coreConf.TCPConfig{
AcceptProxyProtocol: config.EnableProxyProtocol, AcceptProxyProtocol: config.XrayOptions.EnableProxyProtocol,
} //Enable proxy protocol } //Enable proxy protocol
in.StreamSetting.TCPSettings = tcpSetting in.StreamSetting.TCPSettings = tcpSetting
} }
} else if *in.StreamSetting.Network == "ws" { } else if *in.StreamSetting.Network == "ws" {
in.StreamSetting.WSSettings = &coreConf.WebSocketConfig{ in.StreamSetting.WSSettings = &coreConf.WebSocketConfig{
AcceptProxyProtocol: config.EnableProxyProtocol} //Enable proxy protocol AcceptProxyProtocol: config.XrayOptions.EnableProxyProtocol} //Enable proxy protocol
} }
// Set TLS or Reality settings // Set TLS or Reality settings
if nodeInfo.Tls { if nodeInfo.Tls {
@ -124,9 +125,9 @@ func BuildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s
// Support ProxyProtocol for any transport protocol // Support ProxyProtocol for any transport protocol
if *in.StreamSetting.Network != "tcp" && if *in.StreamSetting.Network != "tcp" &&
*in.StreamSetting.Network != "ws" && *in.StreamSetting.Network != "ws" &&
config.EnableProxyProtocol { config.XrayOptions.EnableProxyProtocol {
socketConfig := &coreConf.SocketConfig{ socketConfig := &coreConf.SocketConfig{
AcceptProxyProtocol: config.EnableProxyProtocol, AcceptProxyProtocol: config.XrayOptions.EnableProxyProtocol,
TFO: config.XrayOptions.EnableTFO, TFO: config.XrayOptions.EnableTFO,
} //Enable proxy protocol } //Enable proxy protocol
in.StreamSetting.SocketSettings = socketConfig in.StreamSetting.SocketSettings = socketConfig

View File

@ -15,26 +15,26 @@ type ApiConfig struct {
} }
type ControllerConfig struct { type ControllerConfig struct {
ListenIP string `yaml:"ListenIP"` ListenIP string `yaml:"ListenIP"`
SendIP string `yaml:"SendIP"` SendIP string `yaml:"SendIP"`
EnableProxyProtocol bool `yaml:"EnableProxyProtocol"` XrayOptions XrayOptions `yaml:"XrayOptions"`
XrayOptions XrayOptions `yaml:"XrayOptions"` HyOptions HyOptions `yaml:"HyOptions"`
HyOptions HyOptions `yaml:"HyOptions"` LimitConfig LimitConfig `yaml:"LimitConfig"`
LimitConfig LimitConfig `yaml:"LimitConfig"` CertConfig *CertConfig `yaml:"CertConfig"`
CertConfig *CertConfig `yaml:"CertConfig"`
} }
type XrayOptions struct { type XrayOptions struct {
EnableDNS bool `yaml:"EnableDNS"` EnableProxyProtocol bool `yaml:"EnableProxyProtocol"`
DNSType string `yaml:"DNSType"` EnableDNS bool `yaml:"EnableDNS"`
EnableVless bool `yaml:"EnableVless"` DNSType string `yaml:"DNSType"`
VlessFlow string `json:"VlessFlow"` EnableVless bool `yaml:"EnableVless"`
EnableUot bool `yaml:"EnableUot"` VlessFlow string `json:"VlessFlow"`
EnableTFO bool `yaml:"EnableTFO"` EnableUot bool `yaml:"EnableUot"`
DisableIVCheck bool `yaml:"DisableIVCheck"` EnableTFO bool `yaml:"EnableTFO"`
DisableSniffing bool `yaml:"DisableSniffing"` DisableIVCheck bool `yaml:"DisableIVCheck"`
EnableFallback bool `yaml:"EnableFallback"` DisableSniffing bool `yaml:"DisableSniffing"`
FallBackConfigs []FallBackConfig `yaml:"FallBackConfigs"` EnableFallback bool `yaml:"EnableFallback"`
FallBackConfigs []FallBackConfig `yaml:"FallBackConfigs"`
} }
type HyOptions struct { type HyOptions struct {