package
0.0.2
Repository: https://github.com/yubo/golib.git
Documentation: pkg.go.dev

# Packages

Package ebtables allows to control the ebtables Linux-based bridging firewall.

# Functions

AddIPOffset adds the provided integer offset to a base big.Int representing a net.IP NOTE: If you started with a v4 address and overflow it, you get a v6 result.
Prepares the X-Forwarded-For header for another forwarding hop by appending the previous sender's IP address to the X-Forwarded-For chain.
BigForIP creates a big.Int based on the provided net.IP.
FROM: http://golang.org/src/net/http/transport.go canonicalAddr returns url.Host but always with a ":port" suffix.
ChooseBindAddressForInterface choose a global IP for a specific interface, with priority given to IPv4.
ChooseHostInterface is a method used fetch an IP for a daemon.
CloneHeader creates a deep copy of an http.Header.
CloneRequest creates a shallow copy of the request along with a deep copy of the Headers.
ConnectWithRedirects uses dialer to send req, following up to 10 redirects (relative to originalLocation).
No description provided by the author
No description provided by the author
Extracts and returns the clients IP from the given request.
No description provided by the author
GetIndexedIP returns a net.IP that is subnet.IP + index in the contiguous IP space.
IPNetEqual checks if the two input IPNets are representing the same subnet.
Returns if the given err is "connection refused" error.
Returns if the given err is "connection reset by peer" error.
IsDualStackCIDRs returns if - all are valid cidrs - at least one cidr from each family (v4 or v6).
IsDualStackCIDRStrings returns if - all are valid cidrs - at least one cidr from each family (v4 or v6).
IsDualStackIPs returns if a slice of ips is: - all are valid ips - at least one ip from each family (v4 or v6).
IsDualStackIPStrings returns if - all are valid ips - at least one ip from each family (v4 or v6).
IsIPv4 returns if netIP is IPv4.
IsIPv4CIDR returns if a cidr is ipv4.
IsIPv4CIDRString returns if cidr is IPv4.
IsIPv4String returns if ip is IPv4.
IsIPv6 returns if netIP is IPv6.
IsIPv6CIDR returns if a cidr is ipv6.
IsIPv6CIDRString returns if cidr is IPv6.
IsIPv6String returns if ip is IPv6.
IsNoRoutesError checks if an error is of type noRoutesError.
IsProbableEOF returns true if the given error resembles a connection termination scenario that would justify assuming that the watch is empty.
IsTimeout returns true if the given error is a network timeout error.
JoinPreservingTrailingSlash does a path.Join of the specified elements, preserving any trailing slash on the last non-empty segment.
JoinSchemeNamePort returns a string that specifies the scheme, name, and port: * "<name>" * "<name>:<port>" * "<scheme>:<name>:<port>" None of the parameters may contain a ':' character Name is required Scheme must be "", "http", or "https".
NewLocalPort returns a LocalPort instance and ensures IPFamily and IP are consistent and that the given protocol is valid.
NewProxierWithNoProxyCIDR constructs a Proxier function that respects CIDRs in NO_PROXY and delegates if no matching CIDRs are found.
No description provided by the author
ParseCIDRs parses a list of cidrs and return error if any is invalid.
ParseIPNets parses string slice to IPNetSet.
ParseIPSet parses string slice to IPSet.
ParsePort parses a string representing an IP port.
ParsePortRange parses a string of the form "min-max", inclusive at both ends, and initializes a new PortRange from it.
No description provided by the author
ParseWarningHeader extracts one RFC2616 14.46 warning from the specified header, returning an error if the header does not contain a correctly formatted warning.
ParseWarningHeaders extract RFC2616 14.46 warnings headers from the specified set of header values.
RangeSize returns the size of a range in valid addresses.
ResolveBindAddress returns the IP address of a daemon, based on the given bindAddress: If bindAddress is unset, it returns the host's default IP, as with ChooseHostInterface().
SetOldTransportDefaults applies the defaults from http.DefaultTransport for the Proxy, Dial, and TLSHandshakeTimeout fields if unset.
SetTransportDefaults applies the defaults from http.DefaultTransport for the Proxy, Dial, and TLSHandshakeTimeout fields if unset.
SourceIPs splits the comma separated X-Forwarded-For header and joins it with the X-Real-Ip header and/or req.RemoteAddr, ignoring invalid IPs.
SplitSchemeNamePort takes a string of the following forms: * "<name>", returns "", "<name>","", true * "<name>:<port>", returns "", "<name>","<port>",true * "<scheme>:<name>:<port>", returns "<scheme>","<name>","<port>",true Name must be non-empty or valid will be returned false.
No description provided by the author

# Constants

Constants for valid IPFamilys:.
Constants for valid IPFamilys:.
LoopbackInterfaceName is the default name of the loopback interface.
Constants for valid protocols:.
Constants for valid protocols:.

# Variables

ListenPortOpener opens ports by calling bind() and listen().

# Structs

LocalPort represents an IP address and port pair along with a protocol and potentially a specific IP family.
PortRange represents a range of TCP/UDP ports.
No description provided by the author
No description provided by the author
WarningHeader contains a single RFC2616 14.46 warnings header.

# Interfaces

Closeable closes an opened LocalPort.
Dialer dials a host and writes a request to it.
PortOpener can open a LocalPort and allows later closing it.
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
DialerFunc implements Dialer for the provided function.
No description provided by the author
IPFamily refers to a specific family if not empty, i.e.
IPNetSet maps string to net.IPNet.
IPSet maps string to net.IP.
Protocol is a network protocol support by LocalPort.