uuid

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 5

README

Socket UUIDs for the M-Lab platform

Travis Build Status Coverage Status GoDoc Go Report Card

This allows us to generate a globally unique ID for any TCP socket. When we say globally, we really mean globally - it should be impossible to have two machines generate the same UUID.

The only case the uniqueness of the UUID could be violated is if two machines have the same hostname and booted up at the exact same second in time, but it is bad practice to give machines the same hostname (so don't).

⚠️: This library is fully supported on Linux systems only. Using this library on non Linux system will compile but most likely will not work as intended. Use on non Linux systems at your own risk.

The design of the UUIDs and this system for creating them can be found in DESIGN.md.

Documentation

Overview

Package uuid provides functions that create a consistent globally unique UUID for a given TCP socket. The package defines a new command-line flag `-uuid-prefix-file`, and that file and its contents should be set up prior to invoking any command which uses this library.

This implementation only works reliably on Linux systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromCookie

func FromCookie(cookie uint64) string

FromCookie returns a string that is a globally unique identifier for the passed-in socket cookie.

func FromFile

func FromFile(file *os.File) (string, error)

FromFile returns a string that is a globally unique identifier for the socket represented by the os.File pointer.

This function will never return the empty string, but the returned string value should only be used if the error is nil.

func FromTCPConn

func FromTCPConn(t *net.TCPConn) (string, error)

FromTCPConn returns a string that is a globally unique identifier for the socket held by the passed-in TCPConn (assuming hostnames are unique).

This function will never return the empty string, but the returned string value should only be used if the error is nil.

func SetUUIDPrefixFile added in v1.0.2

func SetUUIDPrefixFile(filename string) error

SetUUIDPrefixFile allows the prefix filename to be passed in via a function call instead of via the command line. This function is useful for programs with custom command lines that want to use this package.

Types

This section is empty.

Directories

Path Synopsis
cmd
Package socookie allows to get a socket's cookie.
Package socookie allows to get a socket's cookie.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL