Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
internal/node, sdk/meshnet: remove unused helpers after PEP refactor
Antonio Ojeaf6669065d3ad
diff --git a/internal/node/controlplane.go b/internal/node/controlplane.goindex 97d36094..ae7c039f 100644--- a/internal/node/controlplane.go+++ b/internal/node/controlplane.go@@ -72,6 +72,11 @@ func (n *AgentMeshNode) fetchControlPlaneInfo(ctx context.Context, controlPlaneUreturn n.controlPlane(controlPlaneURL).FetchInfo(ctx)}+// fetchControlPlaneKeys retrieves the full set of currently valid control+// plane public keys from /keys, the same catch-up path routers use.+// Enrollment only hands out the newest key, so this is how a node learns+// keys still in their rotation grace period, or rotations it missed while+// offline. The set is accepted only if signed by a key in trusted.func (n *AgentMeshNode) fetchControlPlaneKeys(ctx context.Context, controlPlaneURL string, trusted []ed25519.PublicKey) ([]ed25519.PublicKey, error) {return n.controlPlane(controlPlaneURL).FetchKeys(ctx, trusted)}@@ -81,15 +86,6 @@ func FetchControlPlaneInfo(ctx context.Context, controlPlaneURL string) (*api.Coreturn controlPlaneClient(controlPlaneURL).FetchInfo(ctx)}-// FetchControlPlaneKeys retrieves the full set of currently valid control-// plane public keys from /keys, the same catch-up path routers use.-// Enrollment only hands out the newest key, so this is how a node learns-// keys still in their rotation grace period, or rotations it missed while-// offline. The set is accepted only if signed by a key in trusted.-func FetchControlPlaneKeys(ctx context.Context, controlPlaneURL string, trusted []ed25519.PublicKey) ([]ed25519.PublicKey, error) {- return controlPlaneClient(controlPlaneURL).FetchKeys(ctx, trusted)-}-// mergeTrustedKeys replaces the stored trust set with the authoritative set// from /keys, preserving ReceivedAt for keys already known so local grace// pruning keeps working across syncs.diff --git a/internal/node/routers.go b/internal/node/routers.goindex 2ce5f276..676f4960 100644--- a/internal/node/routers.go+++ b/internal/node/routers.go@@ -235,25 +235,6 @@ func (n *AgentMeshNode) WantRouters() int { return n.wantRouters() }// RefreshRouters re-reads the routers from the control plane.func (n *AgentMeshNode) RefreshRouters(ctx context.Context) error { return n.refreshRouterCatalog(ctx) }-// attach marks a router as one the node keeps: protected from the node's-// connection manager, redialled when it drops, and offered to AutoRelay for-// a reservation.-func (n *AgentMeshNode) attach(router peer.ID) {- n.mu.Lock()- if n.attached == nil {- n.attached = map[peer.ID]bool{}- }- n.attached[router] = true- n.mu.Unlock()- if n.connMgr != nil {- n.connMgr.Protect(router, routerTag)- }- n.refreshRelays()- // A router to announce to: services registered before this one was- // held, as the egress assignments are at start, go to the directory now.- n.triggerReprovide()-}-// detach gives a router up: the node stops redialling it and lets the// monitor top up from the others.func (n *AgentMeshNode) detach(router peer.ID) {@@ -286,19 +267,6 @@ func (n *AgentMeshNode) refreshRelays() {n.currentRelays = relays}-// pickRouters chooses k routers to attach to, from the catalog, leaving out-// those already attached, currently dialing or redialing, and those that sent-// the node away. When the catalog has routers and none passes the selector,-// the warning names both sides, since that is a configuration to fix rather-// than a router to wait for.-func (n *AgentMeshNode) pickRouters(k int) []peer.AddrInfo {- cands := n.routerCandidates()- n.mu.Lock()- exclude := n.excludedRoutersLocked()- n.mu.Unlock()- return n.selectAndWarnRouters(cands, k, exclude)-}-func (n *AgentMeshNode) excludedRoutersLocked() map[peer.ID]bool {exclude := make(map[peer.ID]bool, len(n.attached)+len(n.dialing)+len(n.redialing)+len(n.shunned))for pid := range n.attached {diff --git a/sdk/meshnet/statedir_test.go b/sdk/meshnet/statedir_test.goindex 5b41e0b9..dfefd429 100644--- a/sdk/meshnet/statedir_test.go+++ b/sdk/meshnet/statedir_test.go@@ -387,8 +387,6 @@ type fakeControlPlaneHTTP struct {routerAddrs []stringrouters []*api.RouterInfoextraDatalogRules []string- nextCredentialTTL time.Duration- refreshCallTimes []time.Timesrv *httptest.ServerfailKeys atomic.BoolfailRefresh atomic.Bool@@ -556,9 +554,6 @@ func newFakeControlPlaneHTTPWithKeys(t *testing.T, pub ed25519.PublicKey, priv e})})mux.HandleFunc("/refresh", func(w http.ResponseWriter, r *http.Request) {- f.mu.Lock()- f.refreshCallTimes = append(f.refreshCallTimes, time.Now())- f.mu.Unlock()if f.failRefresh.Load() {http.Error(w, "refresh disabled", http.StatusUnauthorized)return@@ -635,27 +630,9 @@ func newFakeControlPlaneHTTPWithKeys(t *testing.T, pub ed25519.PublicKey, priv e}func (f *fakeControlPlaneHTTP) credentialExpiry() time.Time {- f.mu.Lock()- ttl := f.nextCredentialTTL- f.mu.Unlock()- if ttl > 0 {- return time.Now().Add(ttl)- }return time.Now().Add(time.Hour)}-func (f *fakeControlPlaneHTTP) setNextCredentialTTL(ttl time.Duration) {- f.mu.Lock()- f.nextCredentialTTL = ttl- f.mu.Unlock()-}--func (f *fakeControlPlaneHTTP) snapshotRefreshTimes() []time.Time {- f.mu.Lock()- defer f.mu.Unlock()- return append([]time.Time(nil), f.refreshCallTimes...)-}-func (f *fakeControlPlaneHTTP) currentKeys() (ed25519.PublicKey, ed25519.PrivateKey) {f.mu.Lock()defer f.mu.Unlock()