diff --git a/src/admin/addpeer.go b/src/admin/addpeer.go index 843ed52..a897e45 100644 --- a/src/admin/addpeer.go +++ b/src/admin/addpeer.go @@ -12,7 +12,7 @@ type AddPeerRequest struct { type AddPeerResponse struct{} -func (a *AdminSocket) addPeerHandler(req *AddPeerRequest, res *AddPeerResponse) error { +func (a *AdminSocket) addPeerHandler(req *AddPeerRequest, _ *AddPeerResponse) error { u, err := url.Parse(req.Uri) if err != nil { return fmt.Errorf("unable to parse peering URI: %w", err) diff --git a/src/admin/admin.go b/src/admin/admin.go index 8fa76c0..7cca1bb 100644 --- a/src/admin/admin.go +++ b/src/admin/admin.go @@ -201,10 +201,6 @@ func (a *AdminSocket) SetupAdminHandlers() { return res, nil }, ) - //_ = a.AddHandler("getNodeInfo", []string{"key"}, t.proto.nodeinfo.nodeInfoAdminHandler) - //_ = a.AddHandler("debug_remoteGetSelf", []string{"key"}, t.proto.getSelfHandler) - //_ = a.AddHandler("debug_remoteGetPeers", []string{"key"}, t.proto.getPeersHandler) - //_ = a.AddHandler("debug_remoteGetDHT", []string{"key"}, t.proto.getDHTHandler) } // IsStarted returns true if the module has been started. @@ -269,7 +265,6 @@ func (a *AdminSocket) listen() { case "tcp": a.listener, err = net.Listen("tcp", u.Host) default: - // err = errors.New(fmt.Sprint("protocol not supported: ", u.Scheme)) a.listener, err = net.Listen("tcp", listenaddr) } } else { @@ -309,23 +304,6 @@ func (a *AdminSocket) handleRequest(conn net.Conn) { defer conn.Close() - /* - defer func() { - r := recover() - if r != nil { - fmt.Println("ERROR:", r) - a.log.Debugln("Admin socket error:", r) - if err := encoder.Encode(&ErrorResponse{ - Error: "Check your syntax and input types", - }); err != nil { - fmt.Println("ERROR 2:", err) - a.log.Debugln("Admin socket JSON encode error:", err) - } - conn.Close() - } - }() - */ - for { var err error var buf json.RawMessage diff --git a/src/admin/getpaths.go b/src/admin/getpaths.go index 66e11bd..34de453 100644 --- a/src/admin/getpaths.go +++ b/src/admin/getpaths.go @@ -23,7 +23,7 @@ type PathEntry struct { Sequence uint64 `json:"sequence"` } -func (a *AdminSocket) getPathsHandler(req *GetPathsRequest, res *GetPathsResponse) error { +func (a *AdminSocket) getPathsHandler(_ *GetPathsRequest, res *GetPathsResponse) error { paths := a.core.GetPaths() res.Paths = make([]PathEntry, 0, len(paths)) for _, p := range paths { diff --git a/src/admin/getpeers.go b/src/admin/getpeers.go index f79877c..e44428c 100644 --- a/src/admin/getpeers.go +++ b/src/admin/getpeers.go @@ -32,7 +32,7 @@ type PeerEntry struct { LastError string `json:"last_error,omitempty"` } -func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersResponse) error { +func (a *AdminSocket) getPeersHandler(_ *GetPeersRequest, res *GetPeersResponse) error { peers := a.core.GetPeers() res.Peers = make([]PeerEntry, 0, len(peers)) for _, p := range peers { diff --git a/src/admin/getself.go b/src/admin/getself.go index 9b05210..b1a0156 100644 --- a/src/admin/getself.go +++ b/src/admin/getself.go @@ -17,7 +17,7 @@ type GetSelfResponse struct { Subnet string `json:"subnet"` } -func (a *AdminSocket) getSelfHandler(req *GetSelfRequest, res *GetSelfResponse) error { +func (a *AdminSocket) getSelfHandler(_ *GetSelfRequest, res *GetSelfResponse) error { self := a.core.GetSelf() snet := a.core.Subnet() res.BuildName = version.BuildName() diff --git a/src/admin/getsessions.go b/src/admin/getsessions.go index 324119d..e6702f8 100644 --- a/src/admin/getsessions.go +++ b/src/admin/getsessions.go @@ -23,7 +23,7 @@ type SessionEntry struct { Uptime float64 `json:"uptime"` } -func (a *AdminSocket) getSessionsHandler(req *GetSessionsRequest, res *GetSessionsResponse) error { +func (a *AdminSocket) getSessionsHandler(_ *GetSessionsRequest, res *GetSessionsResponse) error { sessions := a.core.GetSessions() res.Sessions = make([]SessionEntry, 0, len(sessions)) for _, s := range sessions { diff --git a/src/admin/gettree.go b/src/admin/gettree.go index 06cf8e7..4b6f32a 100644 --- a/src/admin/gettree.go +++ b/src/admin/gettree.go @@ -20,11 +20,9 @@ type TreeEntry struct { PublicKey string `json:"key"` Parent string `json:"parent"` Sequence uint64 `json:"sequence"` - //Port uint64 `json:"port"` - //Rest uint64 `json:"rest"` } -func (a *AdminSocket) getTreeHandler(req *GetTreeRequest, res *GetTreeResponse) error { +func (a *AdminSocket) getTreeHandler(_ *GetTreeRequest, res *GetTreeResponse) error { tree := a.core.GetTree() res.Tree = make([]TreeEntry, 0, len(tree)) for _, d := range tree { @@ -34,8 +32,6 @@ func (a *AdminSocket) getTreeHandler(req *GetTreeRequest, res *GetTreeResponse) PublicKey: hex.EncodeToString(d.Key[:]), Parent: hex.EncodeToString(d.Parent[:]), Sequence: d.Sequence, - //Port: d.Port, - //Rest: d.Rest, }) } sort.SliceStable(res.Tree, func(i, j int) bool { diff --git a/src/admin/removepeer.go b/src/admin/removepeer.go index 6b2e162..6f36865 100644 --- a/src/admin/removepeer.go +++ b/src/admin/removepeer.go @@ -12,7 +12,7 @@ type RemovePeerRequest struct { type RemovePeerResponse struct{} -func (a *AdminSocket) removePeerHandler(req *RemovePeerRequest, res *RemovePeerResponse) error { +func (a *AdminSocket) removePeerHandler(req *RemovePeerRequest, _ *RemovePeerResponse) error { u, err := url.Parse(req.Uri) if err != nil { return fmt.Errorf("unable to parse peering URI: %w", err) diff --git a/src/core/link.go b/src/core/link.go index fb78004..b646605 100644 --- a/src/core/link.go +++ b/src/core/link.go @@ -378,7 +378,7 @@ func (l *links) add(u *url.URL, sintf string, linkType linkType) error { return retErr } -func (l *links) remove(u *url.URL, sintf string, linkType linkType) error { +func (l *links) remove(u *url.URL, sintf string, _ linkType) error { var retErr error phony.Block(l, func() { // Generate the link info and see whether we think we already @@ -566,7 +566,7 @@ func (l *links) handler(linkType linkType, options linkOptions, conn net.Conn, s switch { case err != nil: return fmt.Errorf("write handshake: %w", err) - case err == nil && n != len(metaBytes): + case n != len(metaBytes): return fmt.Errorf("incomplete handshake send") } meta = version_metadata{} diff --git a/src/core/link_tcp_darwin.go b/src/core/link_tcp_darwin.go index daa51df..4c19ba9 100644 --- a/src/core/link_tcp_darwin.go +++ b/src/core/link_tcp_darwin.go @@ -28,6 +28,6 @@ func (t *linkTCP) tcpContext(network, address string, c syscall.RawConn) error { } } -func (t *linkTCP) getControl(sintf string) func(string, string, syscall.RawConn) error { +func (t *linkTCP) getControl(_ string) func(string, string, syscall.RawConn) error { return t.tcpContext } diff --git a/src/multicast/admin.go b/src/multicast/admin.go index 9bcc257..8b29716 100644 --- a/src/multicast/admin.go +++ b/src/multicast/admin.go @@ -11,7 +11,7 @@ type GetMulticastInterfacesResponse struct { Interfaces []string `json:"multicast_interfaces"` } -func (m *Multicast) getMulticastInterfacesHandler(req *GetMulticastInterfacesRequest, res *GetMulticastInterfacesResponse) error { +func (m *Multicast) getMulticastInterfacesHandler(_ *GetMulticastInterfacesRequest, res *GetMulticastInterfacesResponse) error { res.Interfaces = []string{} for _, v := range m.Interfaces() { res.Interfaces = append(res.Interfaces, v.Name)