znet

package
v0.0.0-...-0521b85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 32 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SNMPSysName     = ".1.3.6.1.2.1.1.5.0"
	SNMPName        = ".1.3.6.1.2.1.1.1.0"
	SNMPSysObjectID = ".1.3.6.1.2.1.1.2.0"
)

Variables

This section is empty.

Functions

func BindPort

func BindPort() error

func CreateSSLCertificate

func CreateSSLCertificate(owner Organization, years int) (caPEMBytes, certPEMBytes, certPrivKeyPEMBytes []byte, expires time.Time, err error)

func CreateSSLCertificateTLSConfig

func CreateSSLCertificateTLSConfig(owner Organization, years int) (serverTLSConf *tls.Config, clientTLSConf *tls.Config, err error)

func CreateSSLCertificateToFilePair

func CreateSSLCertificateToFilePair(owner Organization, years int, certPath, privateKeyPath string) (expires time.Time, err error)

func DNSLookupToIP4

func DNSLookupToIP4(domain string) (string, error)

func ForwardPortToRemote

func ForwardPortToRemote(port int, remoteAddress string) error

func GetCurrentIPAddress

func GetCurrentIPAddress() (address string, err error)

func GetCurrentLocalIP4Address

func GetCurrentLocalIP4Address(skipLocal bool, netInterface string) (ip4 string, err error)

func GetCurrentLocalIP4Addresses

func GetCurrentLocalIP4Addresses(skipLocal bool) (map[string]string, error)

GetCurrentLocalIP4Addresses returns a map of interface:ip4-address

func GetCurrentLocalIPAddress

func GetCurrentLocalIPAddress() (ip16, ip4 string, err error)

TODO: Consolidate with with znet.go variants

func GetIP4AddressAsParts

func GetIP4AddressAsParts(address string) (parts []int, err error)

func GetIP4PartsAsAddress

func GetIP4PartsAsAddress(parts []int) (address string, err error)

func GetOutboundIP

func GetOutboundIP() (ip net.IP, err error)

func GetSNMPVariableStr

func GetSNMPVariableStr(host string, oid string) (string, error)

func GetSNMPVariables

func GetSNMPVariables(host string, oids ...string) (zdict.Dict, error)

func HostAndPortFromAddress

func HostAndPortFromAddress(address string) (string, int)

func HostAndPortToAddress

func HostAndPortToAddress(host string, port int) string

func SetEtcHostsEntries

func SetEtcHostsEntries(forwards map[string]string, comment, sudoPassword string) error

SetEtcHostsEntry adds a 1.2.3.4 example.com #comment line to /etc/hosts Any line with the same comment is removed first. If ip or domain are empty, no line is added. It requires the running user to be able to sudo, and run a shell

func ShowGenerateTLSCertificatesCommands

func ShowGenerateTLSCertificatesCommands(certName string)

func StartForwardProxyTunnel

func StartForwardProxyTunnel(port int)

func StripQueryAndFragment

func StripQueryAndFragment(surl string) string

func WifiName

func WifiName() (name string, err error)

Types

type HTTPServer

type HTTPServer struct {
	Server *http.Server
	// contains filtered or unexported fields
}

func ServeHTTPInBackground

func ServeHTTPInBackground(address string, certificatesStubPath string, handler http.Handler) (server *HTTPServer, certificateExpires time.Time)

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown(wait bool) error

type Organization

type Organization struct {
	Organization  string
	Country       string
	Province      string
	Locality      string
	StreetAddress string
	PostalCode    string
}

type SSLCertificateInfo

type SSLCertificateInfo struct {
	Organization
	YearsUntilExpiry int
}

type ZNetCalls

type ZNetCalls struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL