mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-26 07:40:10 +07:00
fix: sniffed domain with brackets (#70)
* fix: sniffed domain with brackets * Update control/control_plane.go
This commit is contained in:
@ -557,6 +557,10 @@ func (c *ControlPlane) ChooseDialTarget(outbound consts.OutboundIndex, dst netip
|
|||||||
case consts.DialMode_Ip:
|
case consts.DialMode_Ip:
|
||||||
dialTarget = dst.String()
|
dialTarget = dst.String()
|
||||||
case consts.DialMode_Domain:
|
case consts.DialMode_Domain:
|
||||||
|
if strings.HasPrefix(domain, "[") && strings.HasSuffix(domain, "]") {
|
||||||
|
// Sniffed domain may be like `[2606:4700:20::681a:d1f]`. We should remove the brackets.
|
||||||
|
domain = domain[1 : len(domain)-1]
|
||||||
|
}
|
||||||
if _, err := netip.ParseAddr(domain); err == nil {
|
if _, err := netip.ParseAddr(domain); err == nil {
|
||||||
// domain is IPv4 or IPv6 (has colon)
|
// domain is IPv4 or IPv6 (has colon)
|
||||||
dialTarget = net.JoinHostPort(domain, strconv.Itoa(int(dst.Port())))
|
dialTarget = net.JoinHostPort(domain, strconv.Itoa(int(dst.Port())))
|
||||||
|
Reference in New Issue
Block a user