Outbound: Add outbound sendThrough origin behavior (#4349)

* added support of sending through origin for outbounds

* added strings package import

* usage of net.SplitHostPort instead of manual splitting

---------

Co-authored-by: poly <poly@>
This commit is contained in:
lastrise 2025-02-21 00:15:59 +04:00 committed by GitHub
parent b786a50aee
commit 89792aee9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View file

@ -292,7 +292,9 @@ func (c *OutboundDetourConfig) Build() (*core.OutboundHandlerConfig, error) {
senderSettings.ViaCidr = strings.Split(*c.SendThrough, "/")[1]
} else {
if address.Family().IsDomain() {
return nil, errors.New("unable to send through: " + address.String())
if address.Address.Domain() != "origin" {
return nil, errors.New("unable to send through: " + address.String())
}
}
}
senderSettings.Via = address.Build()