Documentation ¶
Index ¶
- func DebugHTTPForm(r *http.Request)
- func HTTPReply(w http.ResponseWriter, r *HTTPResult, j *JSONOutput) (int, error)
- type ErrorCmd
- type HTTPHandlerFunc
- type HTTPResult
- type JSONOutput
- type NetworkStatsResult
- type PeerEntryObj
- type Server
- func (s *Server) DisableDiagnostic()
- func (s *Server) EnableDiagnostic(ip string, port int)
- func (s *Server) Init()
- func (s *Server) IsDiagnosticEnabled() bool
- func (s *Server) RegisterHandler(ctx interface{}, hdlrs map[string]HTTPHandlerFunc)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type StringCmd
- type StringInterface
- type TableEndpointsResult
- type TableEntryObj
- type TableObj
- type TablePeersResult
- type UsageCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugHTTPForm ¶
DebugHTTPForm helper to print the form url parameters
func HTTPReply ¶
func HTTPReply(w http.ResponseWriter, r *HTTPResult, j *JSONOutput) (int, error)
HTTPReply helper function that takes care of sending the message out
Types ¶
type HTTPHandlerFunc ¶
type HTTPHandlerFunc func(interface{}, http.ResponseWriter, *http.Request)
HTTPHandlerFunc TODO
type HTTPResult ¶
type HTTPResult struct { Message string `json:"message"` Details StringInterface `json:"details"` }
HTTPResult Diagnostic Server HTTP result operation
func CommandSucceed ¶
func CommandSucceed(result StringInterface) *HTTPResult
CommandSucceed creates a success message
func FailCommand ¶
func FailCommand(err error) *HTTPResult
FailCommand creates a failure message with error
func WrongCommand ¶
func WrongCommand(message, usage string) *HTTPResult
WrongCommand creates a wrong command response
func (*HTTPResult) String ¶
func (h *HTTPResult) String() string
type JSONOutput ¶
type JSONOutput struct {
// contains filtered or unexported fields
}
JSONOutput contains details on JSON output printing
func ParseHTTPFormOptions ¶
func ParseHTTPFormOptions(r *http.Request) (bool, *JSONOutput)
ParseHTTPFormOptions easily parse the JSON printing options
type NetworkStatsResult ¶
NetworkStatsResult network db stats related to entries and queue len for a network
func (*NetworkStatsResult) String ¶
func (n *NetworkStatsResult) String() string
type PeerEntryObj ¶
PeerEntryObj entry in the networkdb peer table
func (*PeerEntryObj) String ¶
func (p *PeerEntryObj) String() string
type Server ¶
Server when the debug is enabled exposes a This data structure is protected by the Agent mutex so does not require and additional mutex here
func (*Server) DisableDiagnostic ¶
func (s *Server) DisableDiagnostic()
DisableDiagnostic stop the dubug and closes the tcp socket
func (*Server) EnableDiagnostic ¶
EnableDiagnostic opens a TCP socket to debug the passed network DB
func (*Server) Init ¶
func (s *Server) Init()
Init initialize the mux for the http handling and register the base hooks
func (*Server) IsDiagnosticEnabled ¶
IsDiagnosticEnabled returns true when the debug is enabled
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler(ctx interface{}, hdlrs map[string]HTTPHandlerFunc)
RegisterHandler allows to register new handlers to the mux and to a specific path
type StringCmd ¶
type StringCmd struct {
Info string `json:"info"`
}
StringCmd command with info string
type StringInterface ¶
type StringInterface interface {
String() string
}
StringInterface interface that has to be implemented by messages
type TableEndpointsResult ¶
type TableEndpointsResult struct { TableObj Elements []TableEntryObj `json:"entries"` }
TableEndpointsResult fully typed message for proper unmarshaling on the client side
type TableEntryObj ¶
type TableEntryObj struct { Index int `json:"-"` Key string `json:"key"` Value string `json:"value"` Owner string `json:"owner"` }
TableEntryObj network db table entry object
func (*TableEntryObj) String ¶
func (t *TableEntryObj) String() string
type TableObj ¶
type TableObj struct { Length int `json:"size"` Elements []StringInterface `json:"entries"` }
TableObj network db table object
type TablePeersResult ¶
type TablePeersResult struct { TableObj Elements []PeerEntryObj `json:"entries"` }
TablePeersResult fully typed message for proper unmarshaling on the client side