Documentation ¶
Index ¶
- func CanonicalizeTCPAddr(addr *net.TCPAddr) *net.TCPAddr
- func CompareIP(a net.IP, b net.IP) int
- func CompareTCPAddr(a *net.TCPAddr, b *net.TCPAddr) int
- func ErrorOrNil(multi multierror.Error) error
- func ParseBool(str string) (bool, error)
- func ParseIP(host string) (net.IP, error)
- func ParseIPAndZone(host string) (net.IP, string, error)
- func ParsePort(port string) (uint16, error)
- func ParseTCPAddr(str, defaultPort string) (*net.TCPAddr, error)
- func ParseTCPAddrList(str, defaultPort string) ([]*net.TCPAddr, error)
- func SplitHostPort(str, defaultPort string) (host string, port string, err error)
- func StrictUnmarshalJSON(raw []byte, v interface{}) error
- func TryBase64DecodeString(str string) ([]byte, error)
- type Base64DecodeError
- type LookupCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalizeTCPAddr ¶
CanonicalizeTCPAddr takes a TCPAddr and returns a TCPAddr with the same value, but with the guarantee that two calls to CanonicalizeTCPAddr with the same TCPAddr value will return the same pointer.
func CompareTCPAddr ¶
CompareTCPAddr returns {a < b: -1, a == b: 0, a > b: +1}.
func ErrorOrNil ¶ added in v0.4.6
func ErrorOrNil(multi multierror.Error) error
ErrorOrNil is a variant of multierror.(*Error).ErrorOrNil that always makes defensive copies of the error and its list, rather than re-using them. It also auto-flattens the list.
func ParseIPAndZone ¶
ParseIPAndZone parses a string in "<ip>%<zone>" format.
func ParseTCPAddr ¶
ParseTCPAddr parses a string in "<ip>:<port>" format.
func ParseTCPAddrList ¶
ParseTCPAddrList parses a string in "<ip>:<port>,<ip>:<port>,..." format.
func SplitHostPort ¶
SplitHostPort splits a string in "<host>:<port>" format, except that if a port is not present in the string and defaultPort is non-empty, then defaultPort is used instead.
func StrictUnmarshalJSON ¶
StrictUnmarshalJSON is a variant of json.Unmarshal that always sets DisallowUnknownFields() and UseNumber().
func TryBase64DecodeString ¶
TryBase64DecodeString attempts to decode base-64 byte array using any of the standard base-64 encodings.
Types ¶
type Base64DecodeError ¶ added in v0.4.7
Base64DecodeError represents failure to convert a base-64 string to []byte.
func (Base64DecodeError) Error ¶ added in v0.4.7
func (err Base64DecodeError) Error() string
Error fulfills the error interface.
func (Base64DecodeError) Unwrap ¶ added in v0.4.7
func (err Base64DecodeError) Unwrap() error
Unwrap returns the underlying cause of this error.
type LookupCache ¶ added in v0.4.7
type LookupCache struct {
// contains filtered or unexported fields
}
LookupCache is a thread-safe cache that remembers the results of OS user and group lookups.
func (*LookupCache) GroupByID ¶ added in v0.4.7
func (cache *LookupCache) GroupByID(gid uint32) (*user.Group, error)
GroupByID is a cached wrapper of "os/user".LookupGroupId.
func (*LookupCache) GroupByName ¶ added in v0.4.7
func (cache *LookupCache) GroupByName(groupName string) (*user.Group, error)
GroupByName is a cached wrapper of "os/user".LookupGroup.
func (*LookupCache) UserByID ¶ added in v0.4.7
func (cache *LookupCache) UserByID(uid uint32) (*user.User, error)
UserByID is a cached wrapper of "os/user".LookupId.
func (*LookupCache) UserByName ¶ added in v0.4.7
func (cache *LookupCache) UserByName(userName string) (*user.User, error)
UserByName is a cached wrapper of "os/user".Lookup.