go-waku/cmd/waku/server/rpc/debug.go

41 lines
870 B
Go
Raw Normal View History

package rpc
import (
"net/http"
"github.com/waku-org/go-waku/waku/v2/node"
)
type DebugService struct {
node *node.WakuNode
}
type InfoArgs struct {
}
type InfoReply struct {
2022-06-13 18:30:35 +00:00
ENRUri string `json:"enrUri,omitempty"`
ListenAddresses []string `json:"listenAddresses,omitempty"`
}
func NewDebugService(node *node.WakuNode) *DebugService {
return &DebugService{
2022-08-09 14:15:16 +00:00
node: node,
}
}
func (d *DebugService) GetV1Info(r *http.Request, args *InfoArgs, reply *InfoReply) error {
2022-06-13 18:30:35 +00:00
reply.ENRUri = d.node.ENR().String()
for _, addr := range d.node.ListenAddresses() {
reply.ListenAddresses = append(reply.ListenAddresses, addr.String())
}
return nil
}
type VersionResponse string
func (d *DebugService) GetV1Version(r *http.Request, args *InfoArgs, reply *VersionResponse) error {
2022-11-26 01:55:54 +00:00
*reply = VersionResponse(node.GetVersionInfo().String())
return nil
}