func GetSourceAddr()

in internal/network/network.go [46:66]


func GetSourceAddr(
	af string,
	srcAddr string,
	hostname string,
	ifaceName string,
	logger *log.Logger,
) (*net.IP, error) {

	//TODO => resolve if both interface name and source address are specified and they do not match

	// Source address is specified
	if srcAddr != "" {
		return resolveHost(af, hostname, logger)
	}
	// Interface name is specified
	if ifaceName != "" {
		return interfaceAddress(af, ifaceName)
	}

	return anyInterfaceAddress(af)
}