FindPeerByIDPrefix previously returned the first peer whose ID started
with the given prefix, silently ignoring further matches. With Ed25519
peer IDs all sharing the leading "12D3KooW" (8 chars), short prefixes
can match multiple peers; the chosen peer then depends on slice order,
which is effectively undefined from the user's perspective.
Change FindPeerByIDPrefix and its wrapper FindPeerByCLIRef to return
(*Peer, error):
- 0 matches -> (nil, nil)
- 1 match -> (&peer, nil)
- 2+ match -> (nil, error) describing the ambiguity
Call sites in config.Read and rpc/server.go updated accordingly:
ambiguity surfaces as a config-load / CLI error instead of a silent
wrong-peer resolution.
Not a wire-protocol or config-format change. Only behavior visible at
CLI invocation and config load. Users relying on short prefixes that
happened to match multiple peers will now see a clear error and must
lengthen the prefix.
* Added ipfs/go-log and updated up.go
Use ipfs/go-log over fmt.Println
Fixed more log usages with go-log
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
log: refactor log usage to provide module global logger with configurable log level
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
Refactored logger initialization for modules
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
Removed object member loggers
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
* Implemented logging with ipfs/go-log
logging: fix logger level config
Co-authored-by: Max <max@privatevoid.net>
Update svc/network.go
Co-authored-by: Max <max@privatevoid.net>
removed static info log level constant
Co-authored-by: Max <max@privatevoid.net>
Update dns/server.go
Co-authored-by: Max <max@privatevoid.net>
Update dns/server.go
Co-authored-by: Max <max@privatevoid.net>
Update rpc/server.go
Co-authored-by: Max <max@privatevoid.net>
Applied MR suggestions
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
Enhanced logging
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
* update vendorHash
* go fmt
---------
Signed-off-by: Roland Urbano <urbano.roland@gmail.com>
Co-authored-by: Max <max@privatevoid.net>
* node: extract most of the logic from cli/up.go
* node: close interface after bringing it down
* synchronize shutdowns with a WaitGroup
* p2p: use Connect instead of DialPeer
* rpc: defer Close
* remove unused vars/functions
* all constants need explicit types
See https://staticcheck.dev/docs/checks/#SA9004
* cli/up: add missing error checks
* server: fix potential race condition of chown when binding listening socket
a process waiting for the socket appear may bind before we can apply
filesystem permissions.