Skip to content

Commit

Permalink
remove grpc and http
Browse files Browse the repository at this point in the history
  • Loading branch information
yiguo committed Dec 19, 2024
1 parent 7a2781a commit c1d867b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 103 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ This is an Xray wrapper focusing on improving the experience of [Xray-core](http

3. If your issue is about some Platform development, like iOS or Android, it will just be closed.

# Features
4. This lib only keeps compatible with Xray-core latest stable version.

# Features

## nodep

Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/xtls/xray-core => ../Xray-core

require (
github.com/xtls/xray-core v0.0.0-00010101000000-000000000000
google.golang.org/protobuf v1.35.2
google.golang.org/protobuf v1.36.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down Expand Up @@ -38,9 +38,9 @@ require (
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d // indirect
go.uber.org/mock v0.4.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.30.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc // indirect
golang.org/x/mobile v0.0.0-20241204233305-ce44b2716d33 // indirect
golang.org/x/mobile v0.0.0-20241213221354-a87c1cf6cf46 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sync v0.10.0 // indirect
Expand All @@ -50,8 +50,8 @@ require (
golang.org/x/tools v0.28.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect
google.golang.org/genproto v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 // indirect
google.golang.org/genproto v0.0.0-20241216192217-9240e9c98484 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/grpc v1.67.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489 // indirect
Expand Down
32 changes: 13 additions & 19 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,26 @@ go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc h1:O9NuF4s+E/PvMIy+9IUZB9znFwUIXEWSstNjek6VpVg=
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/mobile v0.0.0-20241204233305-ce44b2716d33 h1:MeYjBsMjR6w9aXA3oHEJWCQ5bnD5fOjesYMOn52ovQY=
golang.org/x/mobile v0.0.0-20241204233305-ce44b2716d33/go.mod h1:Sf9LBimL0mWKEdgAjRmJ6iu7Z34osHQTK/devqFbM2I=
golang.org/x/mobile v0.0.0-20241213221354-a87c1cf6cf46 h1:E+R1qmJL8cmWTyWXBHVtmqRxr7FdiTwntffsba1F1Tg=
golang.org/x/mobile v0.0.0-20241213221354-a87c1cf6cf46/go.mod h1:Sf9LBimL0mWKEdgAjRmJ6iu7Z34osHQTK/devqFbM2I=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
Expand All @@ -109,16 +103,16 @@ golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeu
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 h1:/jFs0duh4rdb8uIfPMv78iAJGcPKDeqAFnaLBropIC4=
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173/go.mod h1:tkCQ4FQXmpAgYVh++1cq16/dH4QJtmvpRv19DWGAHSA=
google.golang.org/genproto v0.0.0-20241209162323-e6fa225c2576 h1:k48HcZ4FE6in0o8IflZCkc1lTc2u37nhGd8P+fo4r24=
google.golang.org/genproto v0.0.0-20241209162323-e6fa225c2576/go.mod h1:DV2u3tCn/AcVjjmGYZKt6HyvY4w4y3ipAdHkMbe/0i4=
google.golang.org/genproto v0.0.0-20241216192217-9240e9c98484 h1:a/U5otbGrI6mYIO598WriFB1172i6Ktr6FGcatZD3Yw=
google.golang.org/genproto v0.0.0-20241216192217-9240e9c98484/go.mod h1:Gmd/M/W9fEyf6VSu/mWLnl+9Be51B9CLdxdsKokYq7Y=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 h1:IfdSdTcLFy4lqUQrQJLkLt1PB+AsqVz6lwkWPzWEz10=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
18 changes: 0 additions & 18 deletions share/clash_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ type ClashProxy struct {
Plugin string `yaml:"plugin,omitempty"`
PluginOpts *ClashProxyPluginOpts `yaml:"plugin-opts,omitempty"`
WsOpts *ClashProxyWsOpts `yaml:"ws-opts,omitempty"`
H2Opts *ClashProxyH2Opts `yaml:"h2-opts,omitempty"`
GrpcOpts *ClashProxyGrpcOpts `yaml:"grpc-opts,omitempty"`
SsOpts *ClashProxySsOpts `yaml:"ss-opts,omitempty"`

// the below are fields of hysteria2.
Expand Down Expand Up @@ -379,22 +377,6 @@ func (proxy ClashProxy) streamSettings(outbound conf.OutboundDetourConfig) (*con
wsSettings.Path = proxy.WsOpts.Path
streamSettings.WSSettings = wsSettings
}
case "h2":
if proxy.H2Opts != nil {
httpSettings := &conf.HTTPConfig{}
host := conf.StringList(proxy.H2Opts.Host)
httpSettings.Host = &host
httpSettings.Path = proxy.H2Opts.Path

streamSettings.HTTPSettings = httpSettings
}
case "grpc":
if proxy.GrpcOpts != nil {
grpcSettings := &conf.GRPCConfig{}
grpcSettings.ServiceName = proxy.GrpcOpts.GrpcServiceName

streamSettings.GRPCConfig = grpcSettings
}
}
proxy.parseSecurity(streamSettings, outbound)
return streamSettings, nil
Expand Down
30 changes: 0 additions & 30 deletions share/generate_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,36 +287,6 @@ func streamSettingsQuery(proxy conf.OutboundDetourConfig, link *url.URL) {
if len(host) > 0 {
query = addQuery(query, "host", host)
}
case "grpc":
if streamSettings.GRPCConfig == nil {
break
}
mode := streamSettings.GRPCConfig.MultiMode
if mode {
query = addQuery(query, "mode", "multi")
} else {
query = addQuery(query, "mode", "gun")
}
serviceName := streamSettings.GRPCConfig.ServiceName
if len(serviceName) > 0 {
query = addQuery(query, "serviceName", serviceName)
}
authority := streamSettings.GRPCConfig.Authority
if len(authority) > 0 {
query = addQuery(query, "authority", authority)
}
case "http":
if streamSettings.HTTPSettings == nil {
break
}
host := streamSettings.HTTPSettings.Host
if host != nil && len(*host) > 0 {
query = addQuery(query, "host", strings.Join(*host, ","))
}
path := streamSettings.HTTPSettings.Path
if len(path) > 0 {
query = addQuery(query, "path", path)
}
case "httpupgrade":
if streamSettings.HTTPUPGRADESettings == nil {
break
Expand Down
15 changes: 0 additions & 15 deletions share/parse_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,21 +466,6 @@ func (proxy xrayShareLink) streamSettings(link *url.URL) (*conf.StreamConfig, er
wsSettings.Path = query.Get("path")
wsSettings.Host = query.Get("host")
streamSettings.WSSettings = wsSettings
case "grpc", "gun":
grcpSettings := &conf.GRPCConfig{}
grcpSettings.Authority = query.Get("authority")
grcpSettings.ServiceName = query.Get("serviceName")
grcpSettings.MultiMode = query.Get("mode") == "multi"

streamSettings.GRPCConfig = grcpSettings
case "h2", "http":
httpSettings := &conf.HTTPConfig{}
hosts := strings.Split(query.Get("host"), ",")
host := conf.StringList(hosts)
httpSettings.Host = &host
httpSettings.Path = query.Get("path")

streamSettings.HTTPSettings = httpSettings
case "httpupgrade":
httpupgradeSettings := &conf.HttpUpgradeConfig{}
httpupgradeSettings.Host = query.Get("host")
Expand Down
15 changes: 0 additions & 15 deletions share/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,6 @@ func (proxy vmessQrCode) streamSettings() (*conf.StreamConfig, error) {
wsSettings.Host = proxy.Host

streamSettings.WSSettings = wsSettings
case "grpc", "gun":
grcpSettings := &conf.GRPCConfig{}
grcpSettings.ServiceName = proxy.Path
mode := proxy.Type
grcpSettings.MultiMode = mode == "multi"

streamSettings.GRPCConfig = grcpSettings
case "h2", "http":
httpSettings := &conf.HTTPConfig{}
hosts := strings.Split(proxy.Host, ",")
host := conf.StringList(hosts)
httpSettings.Host = &host
httpSettings.Path = proxy.Path

streamSettings.HTTPSettings = httpSettings
}

err := proxy.parseSecurity(streamSettings)
Expand Down

0 comments on commit c1d867b

Please sign in to comment.