[#10] dialer: Drop nil error

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-08 10:43:43 +03:00
parent 731f2229c0
commit eed340485d
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0

View file

@ -23,7 +23,7 @@ type Dialer interface {
// Multidialer is like Dialer, but supports link state updates. // Multidialer is like Dialer, but supports link state updates.
type Multidialer interface { type Multidialer interface {
Dialer Dialer
UpdateInterface(name string, addr netip.Addr, status bool) error UpdateInterface(name string, addr netip.Addr, status bool)
} }
var ( var (
@ -207,7 +207,7 @@ func processSubnet(subnet string, sources []iface) (Subnet, error) {
// Hostnames for address are currently not supported. // Hostnames for address are currently not supported.
func (d *dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { func (d *dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
addr, err := netip.ParseAddrPort(address) addr, err := netip.ParseAddrPort(address)
if err != nil { //try resolve as hostname if err != nil { // try resolve as hostname
return d.dialContextHostname(ctx, network, address) return d.dialContextHostname(ctx, network, address)
} }
return d.dialAddr(ctx, network, address, addr) return d.dialAddr(ctx, network, address, addr)
@ -389,7 +389,7 @@ func (d *dialer) dialContext(nd *net.Dialer, ctx context.Context, network, addre
// UpdateInterface implements the Multidialer interface. // UpdateInterface implements the Multidialer interface.
// Updating address on a specific interface is currently not supported. // Updating address on a specific interface is currently not supported.
func (d *dialer) UpdateInterface(iface string, addr netip.Addr, up bool) error { func (d *dialer) UpdateInterface(iface string, addr netip.Addr, up bool) {
d.mtx.Lock() d.mtx.Lock()
defer d.mtx.Unlock() defer d.mtx.Unlock()
@ -408,7 +408,6 @@ func (d *dialer) UpdateInterface(iface string, addr netip.Addr, up bool) error {
} }
} }
} }
return nil
} }
// splitByType divides an address list into two categories: // splitByType divides an address list into two categories: