...

Package net

import "github.com/Diarkis/diarkis/net"
Overview
Index

Overview ▾

Constants

Localhost Default address

const Localhost string = "127.0.0.1"

func CreateEndPoint

func CreateEndPoint(configs map[string]interface{}, defaultPort string) (string, string)

CreateEndPoint Creates server end point if port is not available, it automatically searches an open port

func CreateFixedEndPoint

func CreateFixedEndPoint(configs map[string]interface{}, defaultPort string) (string, string)

CreateFixedEndPoint creates an endpoint with the given address and port

func FindAvailablePort

func FindAvailablePort(addr string, port string) string

FindAvailablePort Searches for available port

func FindInterfaces

func FindInterfaces()

FindInterfaces Searches for network interfaces and their addresses

func FindTakenPort

func FindTakenPort(addr string, port string) string

FindTakenPort searches for a port that is already taken:

This is meant to be used to search for internal communication endpoint

func GetAddrByInterfaceName

func GetAddrByInterfaceName(name string) string

GetAddrByInterfaceName Returns an address to bind by network interface name

func GetLocalAddrsByFamily

func GetLocalAddrsByFamily(isV4, isV6 bool) []net.IP

GetLocalAddrsByFamily collects IP addresses from network interfaces for specified address family.