fix redirect

This commit is contained in:
ginuerzh 2022-03-29 23:07:56 +08:00
parent cb0d81f938
commit 670a118c6d
4 changed files with 21 additions and 7 deletions

View File

@ -158,6 +158,12 @@ func buildConfigFromCmd(services, nodes stringList) (*config.Config, error) {
hopConfig.Interface = v
md.Del("interface")
}
if v := metadata.GetInt(md, "so_mark"); v > 0 {
hopConfig.SockOpts = &config.SockOptsConfig{
Mark: v,
}
md.Del("so_mark")
}
chain.Hops = append(chain.Hops, hopConfig)
}
@ -354,6 +360,12 @@ func buildServiceConfig(url *url.URL) (*config.ServiceConfig, error) {
svc.Interface = v
md.Del("interface")
}
if v := metadata.GetInt(md, "so_mark"); v > 0 {
svc.SockOpts = &config.SockOptsConfig{
Mark: v,
}
md.Del("so_mark")
}
if svc.Forwarder != nil {
svc.Forwarder.Selector = parseSelector(md)

View File

@ -53,7 +53,8 @@ import (
// Register handlers
_ "github.com/go-gost/x/handler/dns"
_ "github.com/go-gost/x/handler/http2"
_ "github.com/go-gost/x/handler/redirect"
_ "github.com/go-gost/x/handler/redirect/tcp"
_ "github.com/go-gost/x/handler/redirect/udp"
_ "github.com/go-gost/x/handler/relay"
_ "github.com/go-gost/x/handler/sni"
_ "github.com/go-gost/x/handler/ss"
@ -77,6 +78,7 @@ import (
_ "github.com/go-gost/x/listener/obfs/tls"
_ "github.com/go-gost/x/listener/pht"
_ "github.com/go-gost/x/listener/quic"
_ "github.com/go-gost/x/listener/redirect/tcp"
_ "github.com/go-gost/x/listener/redirect/udp"
_ "github.com/go-gost/x/listener/ssh"
_ "github.com/go-gost/x/listener/sshd"

4
go.mod
View File

@ -5,8 +5,8 @@ go 1.18
replace github.com/templexxx/cpu v0.0.7 => github.com/templexxx/cpu v0.0.10-0.20211111114238-98168dcec14a
require (
github.com/go-gost/core v0.0.0-20220318131726-78089d88873f
github.com/go-gost/x v0.0.0-20220318131912-6a6367b8d12f
github.com/go-gost/core v0.0.0-20220329150412-47cfc087e961
github.com/go-gost/x v0.0.0-20220329150552-8564d711b8b0
)
require (

8
go.sum
View File

@ -121,8 +121,8 @@ github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gost/core v0.0.0-20220318131726-78089d88873f h1:xg+nZO1V+82TJzsZOeHH1lYoAlZpdYdU+Aiz4BGgaVs=
github.com/go-gost/core v0.0.0-20220318131726-78089d88873f/go.mod h1:oga1T7DJPJM+DpiQaZvTES9P9jvybRSgR/V5j+sEDpg=
github.com/go-gost/core v0.0.0-20220329150412-47cfc087e961 h1:LEn+2WGTW60hTtfQxpVIICzGBsfZ9cUMjRdi9GuUhlo=
github.com/go-gost/core v0.0.0-20220329150412-47cfc087e961/go.mod h1:oga1T7DJPJM+DpiQaZvTES9P9jvybRSgR/V5j+sEDpg=
github.com/go-gost/gosocks4 v0.0.1 h1:+k1sec8HlELuQV7rWftIkmy8UijzUt2I6t+iMPlGB2s=
github.com/go-gost/gosocks4 v0.0.1/go.mod h1:3B6L47HbU/qugDg4JnoFPHgJXE43Inz8Bah1QaN9qCc=
github.com/go-gost/gosocks5 v0.3.1-0.20211109033403-d894d75b7f09 h1:A95M6UWcfZgOuJkQ7QLfG0Hs5peWIUSysCDNz4pfe04=
@ -131,8 +131,8 @@ github.com/go-gost/relay v0.1.1-0.20211123134818-8ef7fd81ffd7 h1:itaaJhQJ19kUXEB
github.com/go-gost/relay v0.1.1-0.20211123134818-8ef7fd81ffd7/go.mod h1:lcX+23LCQ3khIeASBo+tJ/WbwXFO32/N5YN6ucuYTG8=
github.com/go-gost/tls-dissector v0.0.2-0.20211125135007-2b5d5bd9c07e h1:73NGqAs22ey3wJkIYVD/ACEoovuIuOlEzQTEoqrO5+U=
github.com/go-gost/tls-dissector v0.0.2-0.20211125135007-2b5d5bd9c07e/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs=
github.com/go-gost/x v0.0.0-20220318131912-6a6367b8d12f h1:D3a6VqprxZwuzEF1/xVhzz76IWKrX2oHx3KDALyiKx4=
github.com/go-gost/x v0.0.0-20220318131912-6a6367b8d12f/go.mod h1:0eqpLtDleyR05dUACjy3dkhMxVvknt0gPjsH15PXnys=
github.com/go-gost/x v0.0.0-20220329150552-8564d711b8b0 h1:WcOeN0UsRjrVciwYPERh0knpROee9vvbrJRRsqLQn0c=
github.com/go-gost/x v0.0.0-20220329150552-8564d711b8b0/go.mod h1:gGlqK3OtVCg1T6OSLRaeVysCnKBwug7liurnC+t+HU4=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=