Documentation ¶
Index ¶
Constants ¶
View Source
const ( Get = RequestType("get") GetNext = RequestType("getNext") Walk = RequestType("walk") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiListener ¶
type ApiListener struct {
// contains filtered or unexported fields
}
func NewApiListener ¶
func NewApiListener( validator *RequestValidator, requester Requester, logger *zap.SugaredLogger, listen string, socketPermissions os.FileMode, ) *ApiListener
func (*ApiListener) Close ¶
func (l *ApiListener) Close()
func (*ApiListener) ServeHTTP ¶
func (l *ApiListener) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*ApiListener) Start ¶
func (l *ApiListener) Start() error
type ApiRequest ¶
type ApiRequest struct { Host string `json:"host"` Community string `json:"community"` Version SnmpVersion `json:"version"` Retries uint8 `json:"retries"` Timeout time.Duration `json:"timeout"` Requests []Request `json:"requests"` }
func (*ApiRequest) UnmarshalJSON ¶
func (r *ApiRequest) UnmarshalJSON(data []byte) error
type GosnmpRequester ¶
type GosnmpRequester struct {
// contains filtered or unexported fields
}
func NewGosnmpRequester ¶
func NewGosnmpRequester(valueFormatter *ValueFormatter) *GosnmpRequester
func (*GosnmpRequester) ExecuteRequest ¶
func (r *GosnmpRequester) ExecuteRequest(apiRequest *ApiRequest) ([][]any, error)
type Request ¶
type Request struct { RequestType RequestType `json:"request_type"` Oids []string `json:"oids"` MaxRepetitions uint32 `json:"max_repetitions"` }
func (*Request) UnmarshalJSON ¶
type RequestType ¶
type RequestType string
func (*RequestType) UnmarshalJSON ¶
func (t *RequestType) UnmarshalJSON(data []byte) error
type RequestValidator ¶
type RequestValidator struct {
// contains filtered or unexported fields
}
func NewRequestValidator ¶
func NewRequestValidator(maxTimeoutSeconds uint, maxRetries uint8) *RequestValidator
func (*RequestValidator) Validate ¶
func (v *RequestValidator) Validate(apiRequest *ApiRequest) error
type Requester ¶
type Requester interface {
ExecuteRequest(apiRequest *ApiRequest) ([][]any, error)
}
type Response ¶
type SnmpVersion ¶
type SnmpVersion gosnmp.SnmpVersion
func (*SnmpVersion) UnmarshalJSON ¶
func (v *SnmpVersion) UnmarshalJSON(data []byte) error
type ValueFormatter ¶ added in v1.1.0
type ValueFormatter struct {
// contains filtered or unexported fields
}
func NewValueFormatter ¶ added in v1.1.0
func NewValueFormatter(mibDataProvider *mib.DataProvider) *ValueFormatter
Click to show internal directories.
Click to hide internal directories.