MCPcopy Index your code
hub / github.com/coder/coder / NodeID

Function NodeID

tailnet/conn.go:143–152  ·  view source on GitHub ↗

NodeID creates a Tailscale NodeID from the last 8 bytes of a UUID. It ensures the returned NodeID is always positive.

(uid uuid.UUID)

Source from the content-addressed store, hash-verified

141// NodeID creates a Tailscale NodeID from the last 8 bytes of a UUID. It ensures
142// the returned NodeID is always positive.
143func NodeID(uid uuid.UUID) tailcfg.NodeID {
144 // #nosec G115 - This is safe because the next lines ensure the ID is always positive
145 id := int64(binary.BigEndian.Uint64(uid[8:]))
146
147 // ensure id is positive
148 y := id >> 63
149 id = (id ^ y) - y
150
151 return tailcfg.NodeID(id)
152}
153
154// NewConn constructs a new Wireguard server that will accept connections from the addresses provided.
155func NewConn(options *Options) (conn *Conn, err error) {

Callers 1

NewConnFunction · 0.85

Calls 1

Uint64Method · 0.80

Tested by

no test coverage detected