...

Package diagnostic

import "github.com/docker/docker/libnetwork/diagnostic"
Overview
Index

Overview ▾

func DebugHTTPForm

func DebugHTTPForm(r *http.Request)

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

type ErrorCmd

ErrorCmd command with error

type ErrorCmd struct {
    Error string `json:"error"`
}

func (*ErrorCmd) String

func (e *ErrorCmd) String() string

type HTTPResult

HTTPResult Diagnostic Server HTTP result operation

type HTTPResult struct {
    Message string          `json:"message"`
    Details StringInterface `json:"details"`
}

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

JSONOutput contains details on JSON output printing

type JSONOutput struct {
    // contains filtered or unexported fields
}

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

type NetworkStatsResult struct {
    Entries  int `json:"entries"`
    QueueLen int `jsoin:"qlen"`
}

func (*NetworkStatsResult) String

func (n *NetworkStatsResult) String() string

type PeerEntryObj

PeerEntryObj entry in the networkdb peer table

type PeerEntryObj struct {
    Index int    `json:"-"`
    Name  string `json:"-=name"`
    IP    string `json:"ip"`
}

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

type Server struct {
    // contains filtered or unexported fields
}

func New

func New() *Server

New creates a new diagnostic server

func (*Server) DisableDiagnostic

func (s *Server) DisableDiagnostic()

DisableDiagnostic stop the dubug and closes the tcp socket

func (*Server) EnableDiagnostic

func (s *Server) EnableDiagnostic(ip string, port int)

EnableDiagnostic opens a TCP socket to debug the passed network DB

func (*Server) Handle

func (s *Server) Handle(pattern string, handler http.Handler)

Handle registers the handler for the given pattern, replacing any existing handler.

func (*Server) HandleFunc

func (s *Server) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

Handle registers the handler function for the given pattern, replacing any existing handler.

func (*Server) IsDiagnosticEnabled

func (s *Server) IsDiagnosticEnabled() bool

IsDiagnosticEnabled returns true when the debug is enabled

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP this is the method called bu the ListenAndServe, and is needed to allow us to use our custom mux

type StringCmd

StringCmd command with info string

type StringCmd struct {
    Info string `json:"info"`
}

func (*StringCmd) String

func (s *StringCmd) String() string

type StringInterface

StringInterface interface that has to be implemented by messages

type StringInterface interface {
    String() string
}

type TableEndpointsResult

TableEndpointsResult fully typed message for proper unmarshaling on the client side

type TableEndpointsResult struct {
    TableObj
    Elements []TableEntryObj `json:"entries"`
}

type TableEntryObj

TableEntryObj network db table entry object

type TableEntryObj struct {
    Index int    `json:"-"`
    Key   string `json:"key"`
    Value string `json:"value"`
    Owner string `json:"owner"`
}

func (*TableEntryObj) String

func (t *TableEntryObj) String() string

type TableObj

TableObj network db table object

type TableObj struct {
    Length   int               `json:"size"`
    Elements []StringInterface `json:"entries"`
}

func (*TableObj) String

func (t *TableObj) String() string

type TablePeersResult

TablePeersResult fully typed message for proper unmarshaling on the client side

type TablePeersResult struct {
    TableObj
    Elements []PeerEntryObj `json:"entries"`
}

type UsageCmd

UsageCmd command with usage field

type UsageCmd struct {
    Usage string `json:"usage"`
}

func (*UsageCmd) String

func (u *UsageCmd) String() string