diff --git a/pkg/mining/node_service.go b/pkg/mining/node_service.go index 9b76f0c..eb450ac 100644 --- a/pkg/mining/node_service.go +++ b/pkg/mining/node_service.go @@ -126,7 +126,7 @@ func (ns *NodeService) handleNodeInfo(c *gin.Context) { c.JSON(http.StatusOK, response) } -// NodeInitRequest is the request body for node initialization. +// POST /node/init {"name": "my-node", "role": "worker"} type NodeInitRequest struct { Name string `json:"name" binding:"required"` Role string `json:"role"` // "controller", "worker", or "dual" @@ -186,7 +186,7 @@ func (ns *NodeService) handleListPeers(c *gin.Context) { c.JSON(http.StatusOK, peers) } -// AddPeerRequest is the request body for adding a peer. +// POST /peers {"address": "10.0.0.2:9090", "name": "worker-1"} type AddPeerRequest struct { Address string `json:"address" binding:"required"` Name string `json:"name"` @@ -356,7 +356,7 @@ func (ns *NodeService) handlePeerStats(c *gin.Context) { c.JSON(http.StatusOK, stats) } -// RemoteStartRequest is the request body for starting a remote miner. +// POST /remote/{peerId}/start {"minerType": "xmrig", "profileId": "abc123"} type RemoteStartRequest struct { MinerType string `json:"minerType" binding:"required"` ProfileID string `json:"profileId,omitempty"` @@ -388,7 +388,7 @@ func (ns *NodeService) handleRemoteStart(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"status": "miner started"}) } -// RemoteStopRequest is the request body for stopping a remote miner. +// POST /remote/{peerId}/stop {"minerName": "xmrig-main"} type RemoteStopRequest struct { MinerName string `json:"minerName" binding:"required"` } @@ -450,7 +450,7 @@ func (ns *NodeService) handleRemoteLogs(c *gin.Context) { c.JSON(http.StatusOK, logs) } -// AuthModeResponse is the response for auth mode endpoints. +// GET /peers/auth/mode → {"mode": "open"} or {"mode": "allowlist"} type AuthModeResponse struct { Mode string `json:"mode"` } @@ -471,7 +471,7 @@ func (ns *NodeService) handleGetAuthMode(c *gin.Context) { c.JSON(http.StatusOK, AuthModeResponse{Mode: modeStr}) } -// SetAuthModeRequest is the request for setting auth mode. +// PUT /peers/auth/mode {"mode": "allowlist"} // or "open" type SetAuthModeRequest struct { Mode string `json:"mode" binding:"required"` } @@ -508,7 +508,7 @@ func (ns *NodeService) handleSetAuthMode(c *gin.Context) { c.JSON(http.StatusOK, AuthModeResponse{Mode: req.Mode}) } -// AllowlistResponse is the response for listing allowlisted keys. +// GET /peers/auth/allowlist → {"publicKeys": ["ed25519:abc...", "ed25519:def..."]} type AllowlistResponse struct { PublicKeys []string `json:"publicKeys"` } @@ -525,7 +525,7 @@ func (ns *NodeService) handleListAllowlist(c *gin.Context) { c.JSON(http.StatusOK, AllowlistResponse{PublicKeys: keys}) } -// AddAllowlistRequest is the request for adding a key to the allowlist. +// POST /peers/auth/allowlist {"publicKey": "ed25519:abc123..."} type AddAllowlistRequest struct { PublicKey string `json:"publicKey" binding:"required"` }