Documentation ¶
Index ¶
- Variables
- func CheckForNewerVersion(client *github.Client, currentVersion string) (bool, string, error)
- func ContainsDomain(domains []string, host string) bool
- func ContainsIP(subnets []*net.IPNet, ip net.IP) bool
- func EnsureSliceContainsAll(data []string, mandatory []string) []string
- func GetLatestReleaseVersion(client *github.Client, owner, repo string) (string, error)
- func GetRelativeFirstSeenTimestamp(useCurrentTime bool, maxTimestamp time.Time) time.Time
- func IPIsPubliclyRoutable(ip net.IP) bool
- func ParseNetworkID(ip net.IP, agentID string) uuid.UUID
- func ParseRelativePath(dir string) (string, error)
- func ParseSubnets(subnets []string) ([]*net.IPNet, error)
- func SortUInt32s(data []uint32)
- func UInt32sAreSorted(data []uint32) bool
- func ValidFQDN(value string) bool
- func ValidateDirectory(afs afero.Fs, dir string) error
- func ValidateFile(afs afero.Fs, file string) error
- func ValidateTimestamp(timestamp time.Time) (time.Time, bool)
- type FixedString
Constants ¶
This section is empty.
Variables ¶
var ( PublicNetworkUUID = uuid.MustParse("ffffffff-ffff-ffff-ffff-ffffffffffff") PublicNetworkName = "Public" UnknownPrivateNetworkUUID = uuid.MustParse("ffffffff-ffff-ffff-ffff-fffffffffffe") UnknownPrivateNetworkName = "Unknown Private" ErrInvalidPath = errors.New("path cannot be empty string") ErrFileDoesNotExist = errors.New("file does not exist") ErrFileIsEmtpy = errors.New("file is empty") ErrPathIsDir = errors.New("given path is a directory, not a file") ErrDirDoesNotExist = errors.New("directory does not exist") ErrDirIsEmpty = errors.New("directory is empty") ErrPathIsNotDir = errors.New("given path is not a directory") )
Functions ¶
func CheckForNewerVersion ¶
CheckForNewerVersion checks if a newer version of the project is available on the GitHub repository
func ContainsDomain ¶
ContainsDomain checks if a given host is in a list of domains
func ContainsIP ¶
ContainsIP checks if a collection of subnets contains an IP
func EnsureSliceContainsAll ¶
EnsureSliceContainsAll ensures that a given slice contains all elements of a mandatory list
func GetLatestReleaseVersion ¶ added in v5.0.5
GetLatestReleaseVersion gets the latest release version from the GitHub repository
func GetRelativeFirstSeenTimestamp ¶
GetRelativeFirstSeenTimestamp returns the timestamp to use for first seen calculation/display. This is a shortcut for a commonly used if statement
func IPIsPubliclyRoutable ¶
IPIsPubliclyRoutable checks if an IP address is publicly routable. See privateIPBlocks.
func ParseNetworkID ¶
ParseNetworkID returns the network ID for a given IP address and agent ID
func ParseRelativePath ¶
ParseRelativePath parses a given directory path and returns the absolute path
func ParseSubnets ¶
ParseSubnets parses the provided subnets into net.IPNet format
func SortUInt32s ¶
func SortUInt32s(data []uint32)
SortUInt32s sorts a slice of uint32 in ascending order
func UInt32sAreSorted ¶
UInt32sAreSorted returns true if a slice of uint32 is sorted in ascending order
func ValidateDirectory ¶
ValidateDirectory returns whether a directory exists and is empty
Types ¶
type FixedString ¶
type FixedString struct { Data [16]byte // contains filtered or unexported fields }
func NewFixedStringFromHex ¶
func NewFixedStringFromHex(h string) (FixedString, error)
NewFixedStringFromString creates a FixedString from a passed in hex string
func NewFixedStringHash ¶
func NewFixedStringHash(args ...string) (FixedString, error)
NewFixedStringHash creates a FixedString from a hash of all the passed in strings
func (*FixedString) Hex ¶
func (bin *FixedString) Hex() string
func (FixedString) MarshalBinary ¶
func (bin FixedString) MarshalBinary() ([]byte, error)
Returns expected type for writing to the database
func (*FixedString) UnmarshalBinary ¶
func (bin *FixedString) UnmarshalBinary(b []byte) error
Returns expected type for reading from the database