Skip to content

chore: remove dead code and fix stale naming (#76, #77)#80

Merged
LiranCohen merged 1 commit into
mainfrom
chore/audit-cleanup
Feb 26, 2026
Merged

chore: remove dead code and fix stale naming (#76, #77)#80
LiranCohen merged 1 commit into
mainfrom
chore/audit-cleanup

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

Removes 651 lines of dead code and fixes stale naming/comments across the entire codebase, based on findings from the audit (issues #76 and #77).

Dead code removed (#76)

internal/control/

  • UpdateFunc / WithUpdateHandler / onUpdate — callback stored but never invoked
  • entryMetadata.Tags — populated but never read
  • RelayData.RecordID — never populated or read
  • NetworkConfig.ListenPort / DefaultRelays — never read
  • DNSConfig.Domains — never populated in production

internal/engine/

  • Engine.dwnClient, .converter, .sys, .dialer, .autoKeyDelivery — stored but never read after construction
  • DWNControl.hostinfo, .netinfo, .endpoints — written, never read
  • loadAndPush loginFinished parameter — never used in function body

internal/dwn/

  • ProtocolAPI subsystem (~240 lines) — entirely self-referential, never called
  • ReadData() / byteReader — never called
  • ErrJSONRPC / ErrRecordsWriteWS — never referenced
  • 10 unused JSON-RPC error codes
  • InterfaceRecordsSubscribe — never dispatched
  • dataConsumed field — write-only
  • DeriveKeyDeliveryEncryption / DeriveKeyDeliveryWriteEncryption — test-only, no production callers

internal/mesh/

  • ServiceIP — exported but never referenced
  • RegisterNodeParams.DiscoKey — never written or read (disco key exchanged via endpoint records)
  • NodeRegistration.MeshIP — echoes caller's own data, never read
  • 4 unused FetchContextKeyParams fields
  • "peer remove" in command combiner — no handler exists

Stale naming fixed (#77)

  • All "dexnet" references → "meshnet" in control/types.go (9 occurrences)
  • "member" → "node" in comments across packages
  • Consolidated protocol URI to single protocols.MeshProtocolURI constant — removed control.ProtocolMesh and mesh.protocolMesh, replaced 7 hardcoded literals in cmd/meshd/main.go
  • Removed duplicate mesh.PublicEndpoint type — use control.PublicEndpoint everywhere
  • Condensed 38-line design journal comment in keydelivery.go to 4 lines

Verification

  • go build ./... — zero errors
  • go vet ./... — zero warnings
  • go test ./... -count=1 -race — all tests pass, no data races

Closes #76, closes #77

Remove dead code identified in the codebase audit and fix stale
naming/comments across all packages.

Dead code removed (issue #76):
- control: UpdateFunc/WithUpdateHandler/onUpdate (never invoked),
  entryMetadata.Tags (populated but never read), RelayData.RecordID
  (never populated), NetworkConfig.ListenPort/DefaultRelays (never read),
  DNSConfig.Domains (never populated in production)
- engine: Engine.dwnClient/.converter/.sys/.dialer/.autoKeyDelivery
  (stored but never read after construction), DWNControl.hostinfo/
  .netinfo/.endpoints (written, never read), loadAndPush loginFinished
  parameter (never used in function body)
- dwn: ProtocolAPI subsystem (~240 lines, entirely self-referential),
  ReadData/byteReader (never called), ErrJSONRPC/ErrRecordsWriteWS
  (never referenced), 10 unused JSON-RPC error codes,
  InterfaceRecordsSubscribe (never dispatched), dataConsumed field
  (write-only), DeriveKeyDeliveryEncryption/WriteEncryption (test-only)
- mesh: ServiceIP (never referenced), RegisterNodeParams.DiscoKey
  (never written or read), NodeRegistration.MeshIP (echoes caller data),
  4 unused FetchContextKeyParams fields, "peer remove" stub in command
  combiner (no handler)

Stale naming fixed (issue #77):
- Replaced all "dexnet" references with "meshnet" in control/types.go
- Updated "member" → "node" in comments across packages
- Consolidated protocol URI to single protocols.MeshProtocolURI constant
  (removed control.ProtocolMesh and mesh.protocolMesh, replaced 7
  hardcoded literals in cmd/meshd/main.go)
- Removed duplicate mesh.PublicEndpoint type (use control.PublicEndpoint)
- Condensed 38-line design journal comment in keydelivery.go to 4 lines

All tests pass with -race.
@LiranCohen LiranCohen merged commit 180f61c into main Feb 26, 2026
2 checks passed
@LiranCohen LiranCohen deleted the chore/audit-cleanup branch February 26, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: fix stale comments and naming inconsistencies chore: remove dead code identified in audit

1 participant