Documentation
¶
Index ¶
- Constants
- func AppDataDir(appName string, roaming bool) string
- func CanonicalIPandPort(hostPort string) (string, error)
- func CopyVarint64(buffer []byte) []byte
- func FromBase58(b string) []byte
- func FromVarint64(buffer []byte) (uint64, int)
- func ToBase58(b []byte) string
- func ToVarint64(value uint64) []byte
- type FingerprintBytes
Constants ¶
const Varint64MaximumBytes = 9
maximum possible number of bytes in Varint64
Variables ¶
This section is empty.
Functions ¶
func AppDataDir ¶
AppDataDir returns an operating system specific directory to be used for storing application data for an application.
The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice. An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.
The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default.
Example results:
dir := AppDataDir("myapp", false) POSIX (Linux/BSD): ~/.myapp Mac OS: $HOME/Library/Application Support/Myapp Windows: %LOCALAPPDATA%\Myapp Plan 9: $home/myapp
func CanonicalIPandPort ¶
make the IP:Port canonical
examples:
IPv4: 127.0.0.1:1234 IPv6: [::1]:1234
func CopyVarint64 ¶
make a copy of a Varint64 from the beginning of a buffer
func FromBase58 ¶
FromBase58 decodes a modified base58 string to a byte slice.
func FromVarint64 ¶
convert an array of up to Varint64MaximumBytes to a uint64
also return the number of bytes used as second value returns 0, 0 if varint64 buffer is truncated
func ToVarint64 ¶
convert a 64 bit unsigned integer to Varint64
Structure of the result byte 1: ext | B06 | B05 | B04 | B03 | B02 | B01 | B00 byte 2: ext | B13 | B12 | B11 | B10 | B09 | B08 | B07 byte 3: ext | B20 | B19 | B18 | B17 | B16 | B15 | B14 byte 4: ext | B27 | B26 | B25 | B24 | B23 | B22 | B21 byte 5: ext | B34 | B33 | B32 | B31 | B30 | B29 | B28 byte 6: ext | B41 | B40 | B39 | B38 | B37 | B36 | B35 byte 7: ext | B48 | B47 | B46 | B45 | B44 | B43 | B42 byte 8: ext | B55 | B54 | B53 | B52 | B51 | B50 | B49 byte 9: B63 | B62 | B61 | B60 | B59 | B58 | B57 | B56
Types ¶
type FingerprintBytes ¶
to hold type for fingerprint
func Fingerprint ¶
func Fingerprint(certificate []byte) FingerprintBytes
fingerprint a certificate
the fingerprint is SHA256 because of: openssl x509 -noout -in ~/.config/bitmarkd/bitmarkd.crt -text -fingerprint -sha256 so this provides a way to double check on the command line