Documentation ¶
Index ¶
- Constants
- func HttpClientGet(client *http.Client, url string, headers map[string]string) (*http.Response, string, error)
- func HttpClientNewClient(transport *http.Transport) *http.Client
- func HttpClientNewServer() *http.Server
- func HttpClientNewTransPort() *http.Transport
- func HttpClientPost(client *http.Client, url string, inputBody []byte, headers map[string]string) (*http.Response, string, error)
- func HttpClientStartServer(server *http.Server) error
- func NetCheckConectionToServer(domain string, ifacenames ...string) error
- func NetDiscoveryQueryServiceEntry(serviceName, domain string, timeout time.Duration, ifaceNames ...string) []*mdns.ServiceEntry
- func NetGetInterfaceIpv4Addr(interfaceName string) (addr string, err error)
- func NetIfaceHasIpv4(interfaceName string) bool
- func NetInitDiscoveryServer(ipService interface{}, serviceport interface{}, id, serviceName string, ...) (s *mdns.Server, err error)
- func NetIsOnlinePing(times, intervalsecs int, ifacenames ...string) bool
- func NetIsOnlineTcp(times, intervalsecs int, ifacenames ...string) bool
- func NetListAllRealIface() ([]string, error)
- func Ping(addr, iface string, timeouts ...time.Duration) (*net.IPAddr, time.Duration, error)
- func ResolverDomain(domain string, debugflag ...bool) (addrs []string, err error)
- func ResolverDomain2Ip4(domain string, debugflag ...bool) (addr string, err error)
- func ServerIsLive(domain string, ifacenames ...string) bool
- type DiscoveryInfo
Constants ¶
View Source
const ( IfaceIname int = iota IfaceMacddr IfaceCidr IfaceIp4 IfaceIp6 IfaceMask )
View Source
const ( // Stolen from https://godoc.org/golang.org/x/net/internal/iana, // can't import "internal" packages ProtocolICMP = 1 )
Variables ¶
This section is empty.
Functions ¶
func HttpClientGet ¶
func HttpClientGet(client *http.Client, url string, headers map[string]string) (*http.Response, string, error)
Don't forget add https:// or http
func HttpClientNewServer ¶
func HttpClientNewTransPort ¶
func HttpClientPost ¶
func HttpClientStartServer ¶
func NetCheckConectionToServer ¶
Check connection to http/https server
return nil if cant connect to server through interface
func NetGetInterfaceIpv4Addr ¶
Get first finded IPv4 address of Linux network interface.
func NetIfaceHasIpv4 ¶
Check if Network Interface has any IPv4 address.
func NetInitDiscoveryServer ¶
func NetInitDiscoveryServer(ipService interface{}, serviceport interface{}, id, serviceName string, info interface{}, ifaceName ...interface{}) (s *mdns.Server, err error)
id is instance in mdns
func NetIsOnlinePing ¶
Check if host machine have internet (check by ping(imcp) to dns servers)
func NetIsOnlineTcp ¶
Check if host machine have internet (check http connection to DNS server )
func NetListAllRealIface ¶
list all real network iface, include ethernet, wlan, docker network
func ResolverDomain ¶
Convert Domain to IP
func ResolverDomain2Ip4 ¶
func ServerIsLive ¶
Check if server is alive, timeout check is 666ms
Types ¶
Click to show internal directories.
Click to hide internal directories.