Documentation
¶
Index ¶
- func BytesToJavaBigIntegerBytes(valueBytes []byte) []byte
- func GetHTTPClient(skipSSL bool, timeout time.Duration) *http.Client
- func GetOidToWalk(base string, instance string) string
- func GetResultForPDU(pdu gosnmp.SnmpPDU, base string) api.SNMPResultDTO
- func NetMessageContains(conn net.Conn, timeout time.Duration, banner string) (bool, error)
- func ParseHTTPResponseRange(responseRange string) (min int, max int)
- func Ping(addr string, timeout time.Duration) (time.Duration, error)
- type MockSNMPClient
- func (cli *MockSNMPClient) BulkWalk(rootOid string, walkFn gosnmp.WalkFunc) error
- func (cli *MockSNMPClient) Connect() error
- func (cli *MockSNMPClient) Disconnect() error
- func (cli *MockSNMPClient) Get(oid string) (result *gosnmp.SnmpPacket, err error)
- func (cli *MockSNMPClient) Target() string
- func (cli *MockSNMPClient) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToJavaBigIntegerBytes ¶
BytesToJavaBigIntegerBytes transforms valueBytes so it can be used to initialize a java.math.BigInteger via the (byte[]) constructor. source: https://github.com/j-white/underling/blob/master/underlinglib/snmp_helper.go
func GetHTTPClient ¶
GetHTTPClient returns an HTTP Client with a given timeout, and transport
func GetOidToWalk ¶
GetOidToWalk builds a walkable OID
func GetResultForPDU ¶
func GetResultForPDU(pdu gosnmp.SnmpPDU, base string) api.SNMPResultDTO
GetResultForPDU get results from a given SNMP PDU
func NetMessageContains ¶
NetMessageContains reads message from network connection and verify if contains banner
func ParseHTTPResponseRange ¶
ParseHTTPResponseRange parses a given response range
Types ¶
type MockSNMPClient ¶
type MockSNMPClient struct { WalkMap map[string][]gosnmp.SnmpPDU GetMap map[string]*gosnmp.SnmpPacket }
MockSNMPClient represents a mock implementation of the SNMP Handler for testing purposes
func (*MockSNMPClient) BulkWalk ¶
func (cli *MockSNMPClient) BulkWalk(rootOid string, walkFn gosnmp.WalkFunc) error
BulkWalk emulates a walk based on the provided list of PDUs
func (*MockSNMPClient) Connect ¶
func (cli *MockSNMPClient) Connect() error
Connect always returns a nil error
func (*MockSNMPClient) Disconnect ¶
func (cli *MockSNMPClient) Disconnect() error
Disconnect always returns a nil error
func (*MockSNMPClient) Get ¶
func (cli *MockSNMPClient) Get(oid string) (result *gosnmp.SnmpPacket, err error)
Get emulates a get based on the provided map of PDU packets
func (*MockSNMPClient) Target ¶
func (cli *MockSNMPClient) Target() string
Target returns a fixed IP for testing purposes
func (*MockSNMPClient) Version ¶
func (cli *MockSNMPClient) Version() string
Version returns a fixed version for testing purposes