Documentation ¶
Index ¶
Constants ¶
View Source
const (
// IPUnknown represents unknown IP address.
IPUnknown = "00000000000000000000000000000000"
)
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(gen Generator)
SetDefault changes the default generator.
The default generator may be changed by the main program, but generally library code shall not call this function.
Types ¶
type Generator ¶
type Generator interface { // Gen generates a new log ID string, it should always return // a valid log ID, and don't generate duplicate log IDs. Gen() string }
func NewV1Gen ¶
func NewV1Gen() Generator
NewV1Gen creates a new v1 log ID generator.
A v1 log ID is consisted of the following parts:
- 1 byte version flag "1"
- 9 bytes milli timestamp, in base32 form
- 16 bytes hash of the machine ID of current host if available, else 16 bytes random data
- 8 bytes random data
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info holds parsed information of a log ID string.
func (Info) Random ¶
Random returns the random part of the log ID if available, else it returns an empty string.
func (Info) Time ¶
Time returns the time information of the log ID if available, else it returns a zero time.Time{}.
Click to show internal directories.
Click to hide internal directories.