Skip to content

Commit 3b01244

Browse files
committed
Fix: DialConfig.ResolveIP is called even when the destination is an IP address
1 parent 7929fd6 commit 3b01244

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

psiphon/inproxy.go

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -972,26 +972,19 @@ func (brokerDialParams *InproxyBrokerDialParameters) prepareDialConfigs(
972972
p, equivilentTunnelProtocol, brokerDialParams.FragmentorSeed)
973973

974974
// Resolver
975+
//
976+
// DialConfig.ResolveIP is required and called even when the destination
977+
// is an IP address.
975978

976-
var resolveIP func(ctx context.Context, hostname string) ([]net.IP, error)
977-
978-
if net.ParseIP(brokerDialParams.FrontingDialAddress) == nil {
979-
980-
resolver := config.GetResolver()
981-
if resolver == nil {
982-
return errors.TraceNew("missing resolver")
983-
}
984-
985-
resolveIP = func(ctx context.Context, hostname string) ([]net.IP, error) {
986-
IPs, err := resolver.ResolveIP(
987-
ctx, networkID, brokerDialParams.ResolveParameters, hostname)
988-
return IPs, errors.Trace(err)
989-
}
979+
resolver := config.GetResolver()
980+
if resolver == nil {
981+
return errors.TraceNew("missing resolver")
982+
}
990983

991-
} else {
992-
resolveIP = func(ctx context.Context, hostname string) ([]net.IP, error) {
993-
return nil, errors.TraceNew("unexpected resolve")
994-
}
984+
resolveIP := func(ctx context.Context, hostname string) ([]net.IP, error) {
985+
IPs, err := resolver.ResolveIP(
986+
ctx, networkID, brokerDialParams.ResolveParameters, hostname)
987+
return IPs, errors.Trace(err)
995988
}
996989

997990
// DialConfig

0 commit comments

Comments
 (0)