mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 11:35:35 +00:00
22 lines
424 B
Go
22 lines
424 B
Go
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
||
|
//go:build darwin || windows
|
||
|
|
||
|
package netns
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
"net/netip"
|
||
|
)
|
||
|
|
||
|
func parseAddress(address string) (addr netip.Addr, err error) {
|
||
|
host, _, err := net.SplitHostPort(address)
|
||
|
if err != nil {
|
||
|
// error means the string didn't contain a port number, so use the string directly
|
||
|
host = address
|
||
|
}
|
||
|
|
||
|
return netip.ParseAddr(host)
|
||
|
}
|