add proxy protocol support for relay tunnel and rtcp
This commit is contained in:
@ -9,29 +9,34 @@ import (
|
||||
"github.com/go-gost/core/logger"
|
||||
mdata "github.com/go-gost/core/metadata"
|
||||
mdutil "github.com/go-gost/core/metadata/util"
|
||||
"github.com/go-gost/relay"
|
||||
xingress "github.com/go-gost/x/ingress"
|
||||
"github.com/go-gost/x/registry"
|
||||
)
|
||||
|
||||
type metadata struct {
|
||||
readTimeout time.Duration
|
||||
enableBind bool
|
||||
udpBufferSize int
|
||||
noDelay bool
|
||||
hash string
|
||||
entryPoint string
|
||||
ingress ingress.Ingress
|
||||
directTunnel bool
|
||||
readTimeout time.Duration
|
||||
enableBind bool
|
||||
udpBufferSize int
|
||||
noDelay bool
|
||||
hash string
|
||||
directTunnel bool
|
||||
entryPoint string
|
||||
entryPointID relay.TunnelID
|
||||
entryPointProxyProtocol int
|
||||
ingress ingress.Ingress
|
||||
}
|
||||
|
||||
func (h *relayHandler) parseMetadata(md mdata.Metadata) (err error) {
|
||||
const (
|
||||
readTimeout = "readTimeout"
|
||||
enableBind = "bind"
|
||||
udpBufferSize = "udpBufferSize"
|
||||
noDelay = "nodelay"
|
||||
hash = "hash"
|
||||
entryPoint = "entryPoint"
|
||||
readTimeout = "readTimeout"
|
||||
enableBind = "bind"
|
||||
udpBufferSize = "udpBufferSize"
|
||||
noDelay = "nodelay"
|
||||
hash = "hash"
|
||||
entryPoint = "entryPoint"
|
||||
entryPointID = "entryPoint.id"
|
||||
entryPointProxyProtocol = "entryPoint.proxyProtocol"
|
||||
)
|
||||
|
||||
h.md.readTimeout = mdutil.GetDuration(md, readTimeout)
|
||||
@ -46,10 +51,12 @@ func (h *relayHandler) parseMetadata(md mdata.Metadata) (err error) {
|
||||
|
||||
h.md.hash = mdutil.GetString(md, hash)
|
||||
|
||||
h.md.entryPoint = mdutil.GetString(md, entryPoint)
|
||||
h.md.ingress = registry.IngressRegistry().Get(mdutil.GetString(md, "ingress"))
|
||||
h.md.directTunnel = mdutil.GetBool(md, "tunnel.direct")
|
||||
h.md.entryPoint = mdutil.GetString(md, entryPoint)
|
||||
h.md.entryPointID = parseTunnelID(mdutil.GetString(md, entryPointID))
|
||||
h.md.entryPointProxyProtocol = mdutil.GetInt(md, entryPointProxyProtocol)
|
||||
|
||||
h.md.ingress = registry.IngressRegistry().Get(mdutil.GetString(md, "ingress"))
|
||||
if h.md.ingress == nil {
|
||||
var rules []xingress.Rule
|
||||
for _, s := range strings.Split(mdutil.GetString(md, "tunnel"), ",") {
|
||||
|
Reference in New Issue
Block a user