mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Transport: Remove DomainSocket (#3757)
https://github.com/XTLS/Xray-core/pull/3755#issuecomment-2325533003
This commit is contained in:
parent
9a953c070f
commit
c0a98f74fc
15 changed files with 37 additions and 724 deletions
|
@ -12,7 +12,6 @@ type TransportConfig struct {
|
|||
KCPConfig *KCPConfig `json:"kcpSettings"`
|
||||
WSConfig *WebSocketConfig `json:"wsSettings"`
|
||||
HTTPConfig *HTTPConfig `json:"httpSettings"`
|
||||
DSConfig *DomainSocketConfig `json:"dsSettings"`
|
||||
GRPCConfig *GRPCConfig `json:"grpcSettings"`
|
||||
GUNConfig *GRPCConfig `json:"gunSettings"`
|
||||
HTTPUPGRADEConfig *HttpUpgradeConfig `json:"httpupgradeSettings"`
|
||||
|
@ -67,17 +66,6 @@ func (c *TransportConfig) Build() (*global.Config, error) {
|
|||
})
|
||||
}
|
||||
|
||||
if c.DSConfig != nil {
|
||||
ds, err := c.DSConfig.Build()
|
||||
if err != nil {
|
||||
return nil, errors.New("Failed to build DomainSocket config.").Base(err)
|
||||
}
|
||||
config.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{
|
||||
ProtocolName: "domainsocket",
|
||||
Settings: serial.ToTypedMessage(ds),
|
||||
})
|
||||
}
|
||||
|
||||
if c.GRPCConfig == nil {
|
||||
c.GRPCConfig = c.GUNConfig
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/domainsocket"
|
||||
httpheader "github.com/xtls/xray-core/transport/internet/headers/http"
|
||||
"github.com/xtls/xray-core/transport/internet/http"
|
||||
"github.com/xtls/xray-core/transport/internet/httpupgrade"
|
||||
|
@ -313,21 +312,6 @@ func (c *HTTPConfig) Build() (proto.Message, error) {
|
|||
return config, nil
|
||||
}
|
||||
|
||||
type DomainSocketConfig struct {
|
||||
Path string `json:"path"`
|
||||
Abstract bool `json:"abstract"`
|
||||
Padding bool `json:"padding"`
|
||||
}
|
||||
|
||||
// Build implements Buildable.
|
||||
func (c *DomainSocketConfig) Build() (proto.Message, error) {
|
||||
return &domainsocket.Config{
|
||||
Path: c.Path,
|
||||
Abstract: c.Abstract,
|
||||
Padding: c.Padding,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func readFileOrString(f string, s []string) ([]byte, error) {
|
||||
if len(f) > 0 {
|
||||
return filesystem.ReadFile(f)
|
||||
|
@ -646,8 +630,6 @@ func (p TransportProtocol) Build() (string, error) {
|
|||
return "websocket", nil
|
||||
case "h2", "http":
|
||||
return "http", nil
|
||||
case "ds", "domainsocket":
|
||||
return "domainsocket", nil
|
||||
case "grpc", "gun":
|
||||
return "grpc", nil
|
||||
case "httpupgrade":
|
||||
|
@ -783,7 +765,6 @@ type StreamConfig struct {
|
|||
KCPSettings *KCPConfig `json:"kcpSettings"`
|
||||
WSSettings *WebSocketConfig `json:"wsSettings"`
|
||||
HTTPSettings *HTTPConfig `json:"httpSettings"`
|
||||
DSSettings *DomainSocketConfig `json:"dsSettings"`
|
||||
SocketSettings *SocketConfig `json:"sockopt"`
|
||||
GRPCConfig *GRPCConfig `json:"grpcSettings"`
|
||||
GUNConfig *GRPCConfig `json:"gunSettings"`
|
||||
|
@ -818,8 +799,8 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
|
|||
config.SecuritySettings = append(config.SecuritySettings, tm)
|
||||
config.SecurityType = tm.Type
|
||||
case "reality":
|
||||
if config.ProtocolName != "tcp" && config.ProtocolName != "http" && config.ProtocolName != "grpc" && config.ProtocolName != "domainsocket" {
|
||||
return nil, errors.New("REALITY only supports TCP, H2, gRPC and DomainSocket for now.")
|
||||
if config.ProtocolName != "tcp" && config.ProtocolName != "http" && config.ProtocolName != "grpc" {
|
||||
return nil, errors.New("REALITY only supports TCP, H2 and gRPC for now.")
|
||||
}
|
||||
if c.REALITYSettings == nil {
|
||||
return nil, errors.New(`REALITY: Empty "realitySettings".`)
|
||||
|
@ -876,16 +857,6 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
|
|||
Settings: serial.ToTypedMessage(ts),
|
||||
})
|
||||
}
|
||||
if c.DSSettings != nil {
|
||||
ds, err := c.DSSettings.Build()
|
||||
if err != nil {
|
||||
return nil, errors.New("Failed to build DomainSocket config.").Base(err)
|
||||
}
|
||||
config.TransportSettings = append(config.TransportSettings, &internet.TransportConfig{
|
||||
ProtocolName: "domainsocket",
|
||||
Settings: serial.ToTypedMessage(ds),
|
||||
})
|
||||
}
|
||||
if c.GRPCConfig == nil {
|
||||
c.GRPCConfig = c.GUNConfig
|
||||
}
|
||||
|
|
|
@ -553,9 +553,6 @@ func applyTransportConfig(s *StreamConfig, t *TransportConfig) {
|
|||
if s.HTTPSettings == nil {
|
||||
s.HTTPSettings = t.HTTPConfig
|
||||
}
|
||||
if s.DSSettings == nil {
|
||||
s.DSSettings = t.DSConfig
|
||||
}
|
||||
if s.HTTPUPGRADESettings == nil {
|
||||
s.HTTPUPGRADESettings = t.HTTPUPGRADEConfig
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue