Documentation ¶
Index ¶
- Constants
- func BigIntToBase36(val *big.Int) ([]byte, string)
- func CheckSha1HMAC(message, messageMAC, key []byte) bool
- func CheckSha256HMAC(message, messageMAC, key []byte) bool
- func EncodeBytesBase36(by []byte) []byte
- func GetExternalIP() string
- func IsRoutableIPv4(ip string) bool
- func Sha1HMAC(message, key []byte) []byte
- func Sha256HMAC(message, key []byte) []byte
- type RuidGen
Constants ¶
const RuidVer = 1
Variables ¶
This section is empty.
Functions ¶
func BigIntToBase36 ¶
returns both a []byte and a string encoding of the bigInt val using only a-z0-9 characters. Assumes a positive bigInt val. Negative val results are undefined.
func CheckSha1HMAC ¶
CheckMAC returns true if messageMAC is a valid HMAC tag for message.
func CheckSha256HMAC ¶
CheckMAC returns true if messageMAC is a valid HMAC tag for message.
func EncodeBytesBase36 ¶
func GetExternalIP ¶
func GetExternalIP() string
GetExternalIP tries to determine the external IP address used on this host.
func IsRoutableIPv4 ¶
IsRoutableIPv4 returns true if the string in ip represents an IPv4 address that is not private. See http://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces for the numeric ranges that are private. 127.0.0.1, 192.168.0.1, and 172.16.0.1 are examples of non-routables IP addresses.
func Sha256HMAC ¶
Types ¶
type RuidGen ¶
type RuidGen struct {
// contains filtered or unexported fields
}
func NewRuidGen ¶
NewRuidGen(): uniqueLocation should be a byte sequence that is unique to this specific physical location. Suggestions: a hardware mac address, your external ip address, the traceroute out a known distant location on the public internet. The uniqueLocation parameter in the NewRuidGen() call should be as unique as possible.
RuidGen has methods Ruid() and Huid() to generate Ruid and Huid respectively.
func (*RuidGen) Luid64 ¶
Limited to at most 64 bytes. Random number based. Includes a counter than wraps and a PID, so does give some origin tracking capability.
func (*RuidGen) Ruid2 ¶
Ruid2 adds randomness from /dev/urandom and uses a Sha512 hash instead of Sha1. It is really opaque.