Documentation
¶
Index ¶
- Variables
- type BinaryClient
- func (c *BinaryClient) Addr() string
- func (c *BinaryClient) Close() error
- func (c *BinaryClient) Heartbeat(nodeID uint32, sig []byte) (unixTime int64, keyExpiryWarning bool, err error)
- func (c *BinaryClient) Lookup(nodeID uint32) (*wire.LookupResult, error)
- func (c *BinaryClient) Resolve(nodeID, requesterID uint32, sig []byte) (*wire.ResolveResult, error)
- func (c *BinaryClient) SendJSON(msg map[string]interface{}) (map[string]interface{}, error)
- type Client
- func Dial(addr string, opts ...DialOption) (*Client, error)
- func DialPool(addr string, size int, opts ...DialOption) (*Client, error)
- func DialTLS(addr string, tlsConfig *tls.Config, opts ...DialOption) (*Client, error)
- func DialTLSPinned(addr, fingerprint string, opts ...DialOption) (*Client, error)
- func DialTLSPinnedPool(addr, fingerprint string, size int, opts ...DialOption) (*Client, error)
- func DialTLSPool(addr string, tlsConfig *tls.Config, size int, opts ...DialOption) (*Client, error)
- func (c *Client) CheckTrust(nodeA, nodeB uint32) (bool, error)
- func (c *Client) ClearKeyExpiryAdmin(nodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) Close() error
- func (c *Client) CreateManagedNetwork(nodeID uint32, name, joinRule, token, adminToken string, enterprise bool, ...) (map[string]interface{}, error)
- func (c *Client) CreateNetwork(nodeID uint32, name, joinRule, token, adminToken string, enterprise bool, ...) (map[string]interface{}, error)
- func (c *Client) DeleteNetwork(networkID uint16, adminToken string, nodeID ...uint32) (map[string]interface{}, error)
- func (c *Client) DemoteMember(networkID uint16, nodeID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) Deregister(nodeID uint32) (map[string]interface{}, error)
- func (c *Client) DeregisterAdmin(nodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) DirectoryStatus(networkID uint16, adminToken string) (map[string]interface{}, error)
- func (c *Client) DirectorySync(networkID uint16, entries []map[string]interface{}, removeUnlisted bool, ...) (map[string]interface{}, error)
- func (c *Client) EnrollRecovery(nodeID uint32, enrollment, enrollmentSig, signatureB64 string) (map[string]interface{}, error)
- func (c *Client) GetAuditExport(adminToken string) (map[string]interface{}, error)
- func (c *Client) GetAuditLog(networkID uint16, adminToken string) (map[string]interface{}, error)
- func (c *Client) GetExprPolicy(networkID uint16) (map[string]interface{}, error)
- func (c *Client) GetIDPConfig(adminToken string) (map[string]interface{}, error)
- func (c *Client) GetIdentity(nodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) GetKeyInfo(nodeID uint32) (map[string]interface{}, error)
- func (c *Client) GetMemberRole(networkID uint16, targetNodeID uint32) (map[string]interface{}, error)
- func (c *Client) GetMemberTags(netID uint16, targetNodeID uint32) (map[string]interface{}, error)
- func (c *Client) GetNetworkPolicy(networkID uint16) (map[string]interface{}, error)
- func (c *Client) GetProvisionStatus(adminToken string) (map[string]interface{}, error)
- func (c *Client) GetWebhook(adminToken string) (map[string]interface{}, error)
- func (c *Client) GetWebhookDLQ(adminToken string) (map[string]interface{}, error)
- func (c *Client) Heartbeat(nodeID uint32) (map[string]interface{}, error)
- func (c *Client) InviteToNetwork(networkID uint16, inviterID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) JoinNetwork(nodeID uint32, networkID uint16, token string, inviterID uint32, ...) (map[string]interface{}, error)
- func (c *Client) KickMember(networkID uint16, nodeID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) LeaveNetwork(nodeID uint32, networkID uint16, adminToken string) (map[string]interface{}, error)
- func (c *Client) ListNetworks(adminToken ...string) (map[string]interface{}, error)
- func (c *Client) ListNodes(networkID uint16, adminToken ...string) (map[string]interface{}, error)
- func (c *Client) Lookup(nodeID uint32) (map[string]interface{}, error)
- func (c *Client) PollHandshakes(nodeID uint32) (map[string]interface{}, error)
- func (c *Client) PollInvites(nodeID uint32) (map[string]interface{}, error)
- func (c *Client) PromoteMember(networkID uint16, nodeID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) ProvisionNetwork(blueprint map[string]interface{}, adminToken string) (map[string]interface{}, error)
- func (c *Client) Punch(requesterID, nodeA, nodeB uint32) (map[string]interface{}, error)
- func (c *Client) RecoverIdentity(nodeID uint32, recovery, recoverySig, newPubKeyB64 string) (map[string]interface{}, error)
- func (c *Client) Register(listenAddr string) (map[string]interface{}, error)
- func (c *Client) RegisterWithKey(listenAddr, publicKeyB64, owner string, lanAddrs []string, opts ...string) (map[string]interface{}, error)
- func (c *Client) RegisterWithKeyOpts(o RegisterOpts) (map[string]interface{}, error)
- func (c *Client) RegisterWithOwner(listenAddr, owner string) (map[string]interface{}, error)
- func (c *Client) RenameNetwork(networkID uint16, name, adminToken string, nodeID ...uint32) (map[string]interface{}, error)
- func (c *Client) ReportTrust(nodeID, peerID uint32) (map[string]interface{}, error)
- func (c *Client) RequestHandshake(fromNodeID, toNodeID uint32, justification, signatureB64 string) (map[string]interface{}, error)
- func (c *Client) Resolve(nodeID, requesterID uint32) (map[string]interface{}, error)
- func (c *Client) ResolveHostname(hostname string) (map[string]interface{}, error)
- func (c *Client) ResolveHostnameAs(requesterID uint32, hostname string) (map[string]interface{}, error)
- func (c *Client) RespondHandshake(nodeID, peerID uint32, accept bool, signatureB64 string) (map[string]interface{}, error)
- func (c *Client) RespondInvite(nodeID uint32, networkID uint16, accept bool) (map[string]interface{}, error)
- func (c *Client) RevokeTrust(nodeID, peerID uint32) (map[string]interface{}, error)
- func (c *Client) RotateKey(nodeID uint32, signatureB64, newPubKeyB64 string) (map[string]interface{}, error)
- func (c *Client) Send(msg map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) SendContext(ctx context.Context, msg map[string]interface{}) (map[string]interface{}, error)
- func (c *Client) SetAuditExport(format, endpoint, token, index, source, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetExprPolicy(networkID uint16, policyJSON json.RawMessage, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetExternalID(nodeID uint32, externalID, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetHostname(nodeID uint32, hostname string) (map[string]interface{}, error)
- func (c *Client) SetHostnameAdmin(nodeID uint32, hostname, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetIDPConfig(idpType, url, issuer, clientID, tenantID, domain, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetIdentityWebhook(url, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetKeyExpiry(nodeID uint32, expiresAt time.Time) (map[string]interface{}, error)
- func (c *Client) SetKeyExpiryAdmin(nodeID uint32, expiresAt time.Time, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetMemberTags(netID uint16, targetNodeID uint32, tags []string, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetNetworkEnterprise(networkID uint16, enterprise bool, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetNetworkPolicy(networkID uint16, policy map[string]interface{}, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetSigner(fn func(challenge string) string)
- func (c *Client) SetTags(nodeID uint32, tags []string) (map[string]interface{}, error)
- func (c *Client) SetTagsAdmin(nodeID uint32, tags []string, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetVisibility(nodeID uint32, public bool) (map[string]interface{}, error)
- func (c *Client) SetVisibilityAdmin(nodeID uint32, public bool, adminToken string) (map[string]interface{}, error)
- func (c *Client) SetWebhook(url, adminToken string) (map[string]interface{}, error)
- func (c *Client) SubmitBadge(nodeID uint32, badge, badgeSig, signatureB64 string) (map[string]interface{}, error)
- func (c *Client) TransferOwnership(networkID uint16, ownerNodeID, newOwnerID uint32, adminToken string) (map[string]interface{}, error)
- func (c *Client) ValidateToken(token, adminToken string) (map[string]interface{}, error)
- type DialContextFunc
- type DialOption
- type RegisterOpts
Constants ¶
This section is empty.
Variables ¶
var ErrClosed error = closedError{}
ErrClosed is returned by every request method of a closed *Client or *BinaryClient, including requests that were still in flight when Close ran. errors.Is(ErrClosed, ErrNoRegistry) is true, so callers that already treat "no registry" as recoverable handle a closed client (for example one retired by a forced reconnect) the same way.
var ErrNoRegistry = errors.New("registry client not configured")
ErrNoRegistry is returned from every exported *Client method when the receiver is a typed nil pointer. Callers (loadPolicyRunners, ManagedEngine.fetchMembers, Daemon.Info → nodeNetworks, etc.) sometimes invoke registry methods before the client is configured; returning this sentinel instead of panicking lets them treat "no registry" as a recoverable condition.
Functions ¶
This section is empty.
Types ¶
type BinaryClient ¶
type BinaryClient struct {
// contains filtered or unexported fields
}
BinaryClient talks to a registry server using the binary wire protocol. It provides native binary encoding for hot-path operations (heartbeat, lookup, resolve) and JSON-over-binary passthrough for all other operations.
func DialBinary ¶
func DialBinary(addr string, opts ...DialOption) (*BinaryClient, error)
DialBinary connects to a registry server and negotiates the binary wire protocol. The server detects the magic bytes and switches to binary mode for this connection. Pass WithDialer to route the connection (and every reconnect) through a custom dialer such as an HTTP CONNECT proxy.
func (*BinaryClient) Addr ¶
func (c *BinaryClient) Addr() string
Addr returns the registry address this client is connected to.
func (*BinaryClient) Close ¶
func (c *BinaryClient) Close() error
Close shuts down the binary client connection. It is idempotent: the teardown runs once, later calls return nil, and every call after Close returns an error matching ErrClosed.
func (*BinaryClient) Heartbeat ¶
func (c *BinaryClient) Heartbeat(nodeID uint32, sig []byte) (unixTime int64, keyExpiryWarning bool, err error)
Heartbeat sends a binary heartbeat and returns the server time and key expiry warning.
func (*BinaryClient) Lookup ¶
func (c *BinaryClient) Lookup(nodeID uint32) (*wire.LookupResult, error)
Lookup sends a binary lookup request and returns the decoded result.
func (*BinaryClient) Resolve ¶
func (c *BinaryClient) Resolve(nodeID, requesterID uint32, sig []byte) (*wire.ResolveResult, error)
Resolve sends a binary resolve request and returns the decoded result.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a registry server over TCP (optionally TLS). It automatically reconnects if the connection drops.
By default a Client owns a single TCP connection (Dial / DialTLS / DialTLSPinned). Each Send takes c.mu and serialises the entire request/response round-trip on that one conn. Under heavy concurrent load (the §4.8 lock-graph stress harness — 250 heartbeat goroutines per daemon hammering Health / Info / SetTags / ResolveHostname plus the per-resolve prewarm goroutines and persistHostnameCache writers, all funnelling through regConn.Send) that single mutex becomes the bottleneck: in-flight calls cannot honour shutdown signals because they're queued behind the mutex.
DialPool / DialTLSPool create a Client backed by a small pool of connections (the primary c.conn plus N-1 secondary conns). Each concurrent Send picks a free pooled conn (blocking only if every conn is in use), eliminating the head-of-line wait. The primary c.conn / c.mu / c.closed fields are retained for backward compatibility with tests that touch them directly.
Every Dial* constructor accepts DialOptions; WithDialer routes all of the client's connections (initial, pool and reconnect) through a custom dialer, e.g. an HTTP CONNECT proxy from the netproxy package.
func Dial ¶
func Dial(addr string, opts ...DialOption) (*Client, error)
Dial connects to a registry server over plain TCP. Pass WithDialer to route the connection (and every reconnect) through a custom dialer such as an HTTP CONNECT proxy.
func DialPool ¶
func DialPool(addr string, size int, opts ...DialOption) (*Client, error)
DialPool connects to a registry server over plain TCP and pre-warms a pool of `size` connections (size >= 1). When size == 1 this is identical to Dial. When size > 1, additional secondary conns are dialed; concurrent Send calls then run in parallel up to `size` at a time, instead of all queueing on a single mutex.
DialPool exists to fix #93 (regConn fairness under sustained load): the daemon's IPC handlers spawn goroutines that all call regConn.Send and previously serialised on c.mu. With DialPool the daemon can keep the same code path while letting up to `size` registry round-trips run concurrently.
On any pool conn dial failure DialPool closes the conns it had already opened and returns an error.
func DialTLS ¶
DialTLS connects to a registry server over TLS. A non-nil tlsConfig is required. For certificate pinning, use DialTLSPinned.
func DialTLSPinned ¶
func DialTLSPinned(addr, fingerprint string, opts ...DialOption) (*Client, error)
DialTLSPinned connects to a registry server over TLS with certificate pinning. The fingerprint is a hex-encoded SHA-256 hash of the server's DER-encoded certificate.
func DialTLSPinnedPool ¶ added in v0.5.14
func DialTLSPinnedPool(addr, fingerprint string, size int, opts ...DialOption) (*Client, error)
DialTLSPinnedPool is the pooled variant of DialTLSPinned (see DialPool).
func DialTLSPool ¶
DialTLSPool is the TLS variant of DialPool.
func (*Client) CheckTrust ¶
CheckTrust checks if a trust pair or shared network exists between two nodes.
func (*Client) ClearKeyExpiryAdmin ¶
func (c *Client) ClearKeyExpiryAdmin(nodeID uint32, adminToken string) (map[string]interface{}, error)
ClearKeyExpiryAdmin removes the key expiry from a node using admin token auth.
func (*Client) Close ¶
Close closes every registry connection of the client. It is idempotent and safe to call concurrently with itself and with in-flight requests: the teardown runs exactly once, later calls return nil, and every request that is in flight or starts afterwards fails with an error matching ErrClosed (and ErrNoRegistry) instead of panicking.
func (*Client) CreateManagedNetwork ¶
func (c *Client) CreateManagedNetwork(nodeID uint32, name, joinRule, token, adminToken string, enterprise bool, rules string, networkAdminToken ...string) (map[string]interface{}, error)
CreateManagedNetwork creates a network with managed rules.
func (*Client) CreateNetwork ¶
func (*Client) DeleteNetwork ¶
func (*Client) DemoteMember ¶
func (c *Client) DemoteMember(networkID uint16, nodeID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
DemoteMember demotes an admin to member. Only the owner can demote.
func (*Client) Deregister ¶
func (*Client) DeregisterAdmin ¶
DeregisterAdmin removes a node using admin token auth.
func (*Client) DirectoryStatus ¶
func (c *Client) DirectoryStatus(networkID uint16, adminToken string) (map[string]interface{}, error)
DirectoryStatus returns directory sync status for a network.
func (*Client) DirectorySync ¶
func (c *Client) DirectorySync(networkID uint16, entries []map[string]interface{}, removeUnlisted bool, adminToken string) (map[string]interface{}, error)
DirectorySync pushes a directory listing to update RBAC roles and membership.
func (*Client) EnrollRecovery ¶ added in v0.5.1
func (c *Client) EnrollRecovery(nodeID uint32, enrollment, enrollmentSig, signatureB64 string) (map[string]interface{}, error)
EnrollRecovery records a node's opaque recovery commitment. signatureB64 is a signature by the node's CURRENT key over "enroll_recovery:<node_id>:<commitment>".
func (*Client) GetAuditExport ¶
GetAuditExport returns the current audit export configuration. Requires admin token.
func (*Client) GetAuditLog ¶
GetAuditLog returns recent audit entries from the registry.
func (*Client) GetExprPolicy ¶
GetExprPolicy returns the programmable policy for a network.
func (*Client) GetIDPConfig ¶
GetIDPConfig returns the current identity provider configuration. Requires admin token.
func (*Client) GetIdentity ¶
GetIdentity returns the external identity of a node. Requires admin token.
func (*Client) GetKeyInfo ¶
GetKeyInfo returns key lifecycle metadata for a node.
func (*Client) GetMemberRole ¶
func (c *Client) GetMemberRole(networkID uint16, targetNodeID uint32) (map[string]interface{}, error)
GetMemberRole returns the RBAC role of a node in a network.
func (*Client) GetMemberTags ¶
GetMemberTags returns admin-assigned member tags for a node (or all members if targetNodeID=0).
func (*Client) GetNetworkPolicy ¶
GetNetworkPolicy returns the policy for a given network.
func (*Client) GetProvisionStatus ¶
GetProvisionStatus returns per-network provisioning status. Requires admin token.
func (*Client) GetWebhook ¶
GetWebhook returns the current webhook configuration.
func (*Client) GetWebhookDLQ ¶
GetWebhookDLQ returns the dead letter queue (failed webhook events).
func (*Client) InviteToNetwork ¶
func (c *Client) InviteToNetwork(networkID uint16, inviterID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
InviteToNetwork stores a pending invite for a target node to join an invite-only network.
func (*Client) JoinNetwork ¶
func (*Client) KickMember ¶
func (c *Client) KickMember(networkID uint16, nodeID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
KickMember removes a member from a network. Requires owner or admin role.
func (*Client) LeaveNetwork ¶
func (*Client) ListNetworks ¶
ListNetworks returns the registry's network catalog. Member counts (the `members` field on each entry) are admin-only — pass a non-empty adminToken to receive them; otherwise the field is omitted.
func (*Client) PollHandshakes ¶
PollHandshakes retrieves and clears pending handshake requests for a node. H3 fix: includes a signature to prove node identity.
func (*Client) PollInvites ¶
PollInvites returns and clears pending network invites for a node. Signed.
func (*Client) PromoteMember ¶
func (c *Client) PromoteMember(networkID uint16, nodeID, targetNodeID uint32, adminToken string) (map[string]interface{}, error)
PromoteMember promotes a network member to admin. Only the owner can promote.
func (*Client) ProvisionNetwork ¶
func (c *Client) ProvisionNetwork(blueprint map[string]interface{}, adminToken string) (map[string]interface{}, error)
ProvisionNetwork applies a network blueprint. Requires admin token.
func (*Client) RecoverIdentity ¶ added in v0.5.1
func (c *Client) RecoverIdentity(nodeID uint32, recovery, recoverySig, newPubKeyB64 string) (map[string]interface{}, error)
RecoverIdentity force-rotates a node's key to newPubKeyB64 using a cold-key-signed recovery authorization — no current key required.
func (*Client) RegisterWithKey ¶
func (c *Client) RegisterWithKey(listenAddr, publicKeyB64, owner string, lanAddrs []string, opts ...string) (map[string]interface{}, error)
RegisterWithKey re-registers using an existing Ed25519 public key. The registry returns the same node_id if the key is known. lanAddrs are the node's LAN addresses for same-network peer detection.
func (*Client) RegisterWithKeyOpts ¶
func (c *Client) RegisterWithKeyOpts(o RegisterOpts) (map[string]interface{}, error)
RegisterWithKeyOpts is the structured-form register call. Existing callers keep using RegisterWithKey; new flags go here.
func (*Client) RegisterWithOwner ¶
RegisterWithOwner registers a new node with an owner identifier (email/name) for key rotation recovery.
func (*Client) RenameNetwork ¶
func (*Client) ReportTrust ¶
func (*Client) RequestHandshake ¶
func (c *Client) RequestHandshake(fromNodeID, toNodeID uint32, justification, signatureB64 string) (map[string]interface{}, error)
RequestHandshake relays a handshake request through the registry to a target node. This works even for private nodes — no IP exposure needed. M12 fix: includes a signature to prove sender identity.
func (*Client) ResolveHostname ¶
ResolveHostname resolves a hostname to node info (node_id, address, public flag).
func (*Client) ResolveHostnameAs ¶
func (c *Client) ResolveHostnameAs(requesterID uint32, hostname string) (map[string]interface{}, error)
ResolveHostnameAs resolves a hostname with a requester_id for privacy checks. Private nodes require the requester to have a trust pair or shared network.
func (*Client) RespondHandshake ¶
func (c *Client) RespondHandshake(nodeID, peerID uint32, accept bool, signatureB64 string) (map[string]interface{}, error)
RespondHandshake approves or rejects a relayed handshake request. If accepted, the registry creates a mutual trust pair. M12 fix: includes a signature to prove responder identity.
func (*Client) RespondInvite ¶
func (c *Client) RespondInvite(nodeID uint32, networkID uint16, accept bool) (map[string]interface{}, error)
RespondInvite accepts or rejects a pending network invite. Signed.
func (*Client) RevokeTrust ¶
func (*Client) RotateKey ¶
func (c *Client) RotateKey(nodeID uint32, signatureB64, newPubKeyB64 string) (map[string]interface{}, error)
RotateKey requests a key rotation for a node. Requires a signature proving ownership of the current key and the new public key.
func (*Client) Send ¶
Send sends a registry message without a deadline. For shutdown-safe use that respects context cancellation, prefer SendContext.
func (*Client) SendContext ¶
func (c *Client) SendContext(ctx context.Context, msg map[string]interface{}) (map[string]interface{}, error)
SendContext sends a registry message with context propagation through reconnect retries. Callers should pass a context with deadline or cancellation (e.g. daemon shutdown context) so that reconnect backoff does not block graceful stop. ctx bounds the wait for a free pooled connection, the retry on another pooled connection and the reconnect; it does not interrupt a round trip on the request's own connection, which the 30 s read deadline bounds.
A connection-level failure (no response) is retried:
- On a single-connection client the connection is redialed and the request sent once more, so it reaches the registry at most twice.
- On a pooled client, when the connection was dropped (EOF, reset, closed) the request is first retried on another idle, healthy pooled connection, bounded by a short deadline and ctx. Only if that fails too is the request's own connection redialed and the request sent a third time. Other connection-level failures (timeouts) go straight to the redial.
So a request whose connections drop may reach the registry more than once (up to three times on a pooled client); an operation that is not safe to repeat may have been applied even when an error is returned. However many attempts fail, one request extends the rapid-close backoff streak at most once. An error response from the registry is returned as is, never retried. After Close every call returns an error matching ErrClosed.
func (*Client) SetAuditExport ¶
func (c *Client) SetAuditExport(format, endpoint, token, index, source, adminToken string) (map[string]interface{}, error)
SetAuditExport configures the audit export adapter. Requires admin token.
func (*Client) SetExprPolicy ¶
func (c *Client) SetExprPolicy(networkID uint16, policyJSON json.RawMessage, adminToken string) (map[string]interface{}, error)
SetExprPolicy sets the programmable policy for a network. Requires owner/admin role or admin token.
func (*Client) SetExternalID ¶
func (c *Client) SetExternalID(nodeID uint32, externalID, adminToken string) (map[string]interface{}, error)
SetExternalID sets the external identity on a node. Requires admin token.
func (*Client) SetHostname ¶
SetHostname sets or clears the hostname for a node. An empty hostname clears the current hostname.
func (*Client) SetHostnameAdmin ¶
func (c *Client) SetHostnameAdmin(nodeID uint32, hostname, adminToken string) (map[string]interface{}, error)
SetHostnameAdmin sets a node's hostname using admin token auth.
func (*Client) SetIDPConfig ¶
func (c *Client) SetIDPConfig(idpType, url, issuer, clientID, tenantID, domain, adminToken string) (map[string]interface{}, error)
SetIDPConfig configures the identity provider. Requires admin token.
func (*Client) SetIdentityWebhook ¶
SetIdentityWebhook configures the identity verification webhook URL.
func (*Client) SetKeyExpiry ¶
SetKeyExpiry sets the key expiry time for a node. Requires signature.
func (*Client) SetKeyExpiryAdmin ¶
func (c *Client) SetKeyExpiryAdmin(nodeID uint32, expiresAt time.Time, adminToken string) (map[string]interface{}, error)
SetKeyExpiryAdmin sets a node's key expiry using admin token auth.
func (*Client) SetMemberTags ¶
func (c *Client) SetMemberTags(netID uint16, targetNodeID uint32, tags []string, adminToken string) (map[string]interface{}, error)
SetMemberTags sets admin-assigned tags for a member within a network.
func (*Client) SetNetworkEnterprise ¶
func (*Client) SetNetworkPolicy ¶
func (c *Client) SetNetworkPolicy(networkID uint16, policy map[string]interface{}, adminToken string) (map[string]interface{}, error)
SetNetworkPolicy sets or updates a network's policy. Requires owner/admin role or admin token.
func (*Client) SetSigner ¶
SetSigner sets a signing function for authenticated registry operations (H3 fix). The signer receives a challenge string and returns a base64-encoded Ed25519 signature.
Issue #93: when the regConn is pooled (DialPool), multiple Send goroutines may call sign() concurrently while a parallel RotateKey path calls SetSigner. We guard the field with c.mu to keep that race-free; reads via sign() take the same lock so the loaded function pointer is consistent.
func (*Client) SetTagsAdmin ¶
func (c *Client) SetTagsAdmin(nodeID uint32, tags []string, adminToken string) (map[string]interface{}, error)
SetTagsAdmin sets a node's tags using admin token auth.
func (*Client) SetVisibility ¶
func (*Client) SetVisibilityAdmin ¶
func (c *Client) SetVisibilityAdmin(nodeID uint32, public bool, adminToken string) (map[string]interface{}, error)
SetVisibilityAdmin sets a node's visibility using admin token auth.
func (*Client) SetWebhook ¶
SetWebhook configures the registry webhook URL. Pass empty string to disable.
func (*Client) SubmitBadge ¶ added in v0.5.1
func (c *Client) SubmitBadge(nodeID uint32, badge, badgeSig, signatureB64 string) (map[string]interface{}, error)
SubmitBadge attaches a verified-address badge to a node. signatureB64 is a signature by the node's CURRENT key over "submit_badge:<node_id>:<badge>", proving ownership; the registry also verifies the badge offline against the pinned issuer key.
type DialContextFunc ¶ added in v0.5.14
DialContextFunc opens a raw stream connection. It has the signature of (*net.Dialer).DialContext and (*netproxy.Dialer).DialContext, so either method value can be passed to WithDialer.
type DialOption ¶ added in v0.5.14
type DialOption func(*dialOptions)
DialOption customises how a Client or BinaryClient establishes its connections. Options are accepted by every Dial* constructor.
func WithDialer ¶ added in v0.5.14
func WithDialer(dial DialContextFunc) DialOption
WithDialer makes the client open EVERY connection through dial: the initial connection, each pool connection, and every reconnect. The registry address is passed to dial unresolved, so a proxy dialer (for example netproxy.Dialer.DialContext, which issues an HTTP CONNECT by host name) sees the registry host name, never a locally resolved IP.
For the TLS constructors the TLS handshake runs on top of the returned conn, end-to-end with the registry. When the tls.Config has no ServerName the host part of the registry address is used, exactly as a direct TLS dial does, so SNI, CA verification and DialTLSPinned's fingerprint check behave the same through the dialer. dial is called with a context bounded by the client's per-attempt dial timeout.
A nil dial (or not passing WithDialer) keeps the default direct dial.
type RegisterOpts ¶
type RegisterOpts struct {
ListenAddr string
PublicKey string // base64 Ed25519
Owner string
LANAddrs []string
Version string
RelayOnly bool // task 32: hide real_addr from peers
}
RegisterOpts is the full set of registration options. Lets us add fields (like RelayOnly for task 32) without breaking the variadic signature of RegisterWithKey.