[#11] dialer: Fix static check warnings
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
aa9c584fac
commit
955de5b50d
2 changed files with 6 additions and 6 deletions
|
@ -36,7 +36,7 @@ func (r *roundRobin) DialContext(ctx context.Context, s *Subnet, network, addres
|
||||||
ii := s.SourceIPs[(i+next)%len(s.SourceIPs)]
|
ii := s.SourceIPs[(i+next)%len(s.SourceIPs)]
|
||||||
dd := r.d.dialer
|
dd := r.d.dialer
|
||||||
dd.LocalAddr = &net.TCPAddr{IP: net.IP(ii.AsSlice())}
|
dd.LocalAddr = &net.TCPAddr{IP: net.IP(ii.AsSlice())}
|
||||||
return r.d.dialContext(&dd, ctx, network, address)
|
return r.d.dialContext(ctx, &dd, network, address)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("(*roundRobin).DialContext: %w", errNoSuitableNodeFound)
|
return nil, fmt.Errorf("(*roundRobin).DialContext: %w", errNoSuitableNodeFound)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func (r *firstEnabled) DialContext(ctx context.Context, s *Subnet, network, addr
|
||||||
ii := s.SourceIPs[i]
|
ii := s.SourceIPs[i]
|
||||||
dd := r.d.dialer
|
dd := r.d.dialer
|
||||||
dd.LocalAddr = &net.TCPAddr{IP: net.IP(ii.AsSlice())}
|
dd.LocalAddr = &net.TCPAddr{IP: net.IP(ii.AsSlice())}
|
||||||
return r.d.dialContext(&dd, ctx, network, address)
|
return r.d.dialContext(ctx, &dd, network, address)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("(*firstEnabled).DialContext: %w", errNoSuitableNodeFound)
|
return nil, fmt.Errorf("(*firstEnabled).DialContext: %w", errNoSuitableNodeFound)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ type Config struct {
|
||||||
// If true, the only configurd subnets available through this dialer.
|
// If true, the only configurd subnets available through this dialer.
|
||||||
// Otherwise, a failback to the net.DefaultDialer.
|
// Otherwise, a failback to the net.DefaultDialer.
|
||||||
Restrict bool
|
Restrict bool
|
||||||
// Dialer containes default options for the net.Dialer to use.
|
// Dialer contains default options for the net.Dialer to use.
|
||||||
// LocalAddr is overriden.
|
// LocalAddr is overridden.
|
||||||
Dialer net.Dialer
|
Dialer net.Dialer
|
||||||
// Balancer specifies algorithm used to pick source address.
|
// Balancer specifies algorithm used to pick source address.
|
||||||
Balancer BalancerType
|
Balancer BalancerType
|
||||||
|
@ -275,10 +275,10 @@ func (d *dialer) dialAddr(ctx context.Context, network, address string, addr net
|
||||||
if d.restrict {
|
if d.restrict {
|
||||||
return nil, fmt.Errorf("no suitable interface for: [%s]%s", network, address)
|
return nil, fmt.Errorf("no suitable interface for: [%s]%s", network, address)
|
||||||
}
|
}
|
||||||
return d.dialContext(&d.dialer, ctx, network, address)
|
return d.dialContext(ctx, &d.dialer, network, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *dialer) dialContext(nd *net.Dialer, ctx context.Context, network, address string) (net.Conn, error) {
|
func (d *dialer) dialContext(ctx context.Context, nd *net.Dialer, network, address string) (net.Conn, error) {
|
||||||
if h := d.customDialContext; h != nil {
|
if h := d.customDialContext; h != nil {
|
||||||
return h(nd, ctx, network, address)
|
return h(nd, ctx, network, address)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue