Add PROXY Protocol support for freedom outbound

This commit is contained in:
Iain Lau 2024-02-03 09:10:23 +08:00 committed by yuhan6665
parent b56917fde5
commit 3a99520370
5 changed files with 80 additions and 22 deletions

View file

@ -17,6 +17,7 @@ type FreedomConfig struct {
Redirect string `json:"redirect"`
UserLevel uint32 `json:"userLevel"`
Fragment *Fragment `json:"fragment"`
ProxyProtocol uint32 `json:"proxyProtocol"`
}
type Fragment struct {
@ -165,5 +166,8 @@ func (c *FreedomConfig) Build() (proto.Message, error) {
config.DestinationOverride.Server.Address = v2net.NewIPOrDomain(v2net.ParseAddress(host))
}
}
if c.ProxyProtocol > 0 && c.ProxyProtocol <= 2 {
config.ProxyProtocol = c.ProxyProtocol
}
return config, nil
}