Documentation ¶
Overview ¶
Package protocols is where the protocol-testers live.
Tests are dynamically instantiated at run-time, via a class-factory pattern, and due to their plugin nature they are simple to implement as they require only implementing a single method.
Index ¶
- func Handlers() []string
- func Register(id string, newfunc TestCtor)
- type DNSTest
- type DumbTest
- type FINGERTest
- func (s *FINGERTest) Arguments() map[string]string
- func (s *FINGERTest) Example() string
- func (s *FINGERTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *FINGERTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *FINGERTest) ShouldResolveHostname() bool
- type FTPTest
- type HTTPTest
- func (s *HTTPTest) Arguments() map[string]string
- func (s *HTTPTest) Example() string
- func (s *HTTPTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *HTTPTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *HTTPTest) SSLExpiration(host string, verbose bool) (int64, string, error)
- func (s *HTTPTest) ShouldResolveHostname() bool
- type IMAPSTest
- func (s *IMAPSTest) Arguments() map[string]string
- func (s *IMAPSTest) Example() string
- func (s *IMAPSTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *IMAPSTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *IMAPSTest) ShouldResolveHostname() bool
- type IMAPTest
- type K8SSvcTest
- func (s *K8SSvcTest) Arguments() map[string]string
- func (s *K8SSvcTest) Example() string
- func (s *K8SSvcTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *K8SSvcTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *K8SSvcTest) ShouldResolveHostname() bool
- type MYSQLTest
- func (s *MYSQLTest) Arguments() map[string]string
- func (s *MYSQLTest) Example() string
- func (s *MYSQLTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *MYSQLTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *MYSQLTest) ShouldResolveHostname() bool
- type NNTPTest
- type PINGTest
- func (s *PINGTest) Arguments() map[string]string
- func (s *PINGTest) Example() string
- func (s *PINGTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *PINGTest) Ping4(target string) bool
- func (s *PINGTest) Ping6(target string) bool
- func (s *PINGTest) RunCommand(name string, args ...string) (stdout string, stderr string, exitCode int)
- func (s *PINGTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *PINGTest) ShouldResolveHostname() bool
- type POP3STest
- func (s *POP3STest) Arguments() map[string]string
- func (s *POP3STest) Example() string
- func (s *POP3STest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *POP3STest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *POP3STest) ShouldResolveHostname() bool
- type POP3Test
- type PSQLTest
- type ProtocolTest
- type REDISTest
- func (s *REDISTest) Arguments() map[string]string
- func (s *REDISTest) Example() string
- func (s *REDISTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *REDISTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *REDISTest) ShouldResolveHostname() bool
- type RSYNCTest
- func (s *RSYNCTest) Arguments() map[string]string
- func (s *RSYNCTest) Example() string
- func (s *RSYNCTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *RSYNCTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *RSYNCTest) ShouldResolveHostname() bool
- type SMTPTest
- type SSHTest
- type SSLTest
- func (s *SSLTest) Arguments() map[string]string
- func (s *SSLTest) Example() string
- func (s *SSLTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *SSLTest) RunTest(tst test.Test, _ string, opts test.Options) error
- func (s *SSLTest) SSLExpiration(host string, verbose bool) (int64, error)
- func (s *SSLTest) ShouldResolveHostname() bool
- type TCPTest
- type TELNETTest
- func (s *TELNETTest) Arguments() map[string]string
- func (s *TELNETTest) Example() string
- func (s *TELNETTest) GetUniqueHashForTest(tst test.Test, opts test.Options) *string
- func (s *TELNETTest) RunTest(tst test.Test, target string, opts test.Options) error
- func (s *TELNETTest) ShouldResolveHostname() bool
- type TestCtor
- type VNCTest
- type XMPPTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DNSTest ¶
type DNSTest struct { }
DNSTest is our object.
func (*DNSTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*DNSTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*DNSTest) GetUniqueHashForTest ¶
func (*DNSTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a DNS-lookup against the named host, and compare the result with what the user specified. look for a response which appears to be an FTP-server.
func (*DNSTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type DumbTest ¶
type DumbTest struct {
// contains filtered or unexported fields
}
DumbTest is our object.
func (*DumbTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*DumbTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*DumbTest) GetUniqueHashForTest ¶
func (*DumbTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
func (*DumbTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type FINGERTest ¶
type FINGERTest struct { }
FINGERTest is our object.
func (*FINGERTest) Arguments ¶
func (s *FINGERTest) Arguments() map[string]string
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*FINGERTest) Example ¶
func (s *FINGERTest) Example() string
Example returns sample usage-instructions for self-documentation purposes.
func (*FINGERTest) GetUniqueHashForTest ¶
func (*FINGERTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 79, and look for a non-empty response.
func (*FINGERTest) ShouldResolveHostname ¶
func (s *FINGERTest) ShouldResolveHostname() bool
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type FTPTest ¶
type FTPTest struct { }
FTPTest is our object.
func (*FTPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*FTPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*FTPTest) GetUniqueHashForTest ¶
func (*FTPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 21, and look for a response which appears to be an FTP-server.
func (*FTPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type HTTPTest ¶
type HTTPTest struct { }
HTTPTest is our object.
func (*HTTPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*HTTPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*HTTPTest) GetUniqueHashForTest ¶
func (*HTTPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a HTTP-test against the given URL.
For the purposes of clarity this test makes a HTTP-fetch. The `test.Test` structure contains our raw test, and the `target` variable contains the IP address against which to make the request.
So:
tst.Target => "https://steve.kemp.fi/ target => "176.9.183.100"
func (*HTTPTest) SSLExpiration ¶
SSLExpiration returns the number of hours remaining for a given SSL certificate chain.
func (*HTTPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type IMAPSTest ¶
type IMAPSTest struct { }
IMAPSTest is our object
func (*IMAPSTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*IMAPSTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*IMAPSTest) GetUniqueHashForTest ¶
func (*IMAPSTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a IMAP connection to the specified host, and if a username + password were specified we then attempt to authenticate to the remote host too.
func (*IMAPSTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type IMAPTest ¶
type IMAPTest struct { }
IMAPTest is our object
func (*IMAPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*IMAPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*IMAPTest) GetUniqueHashForTest ¶
func (*IMAPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a IMAP connection to the specified host, and if a username + password were specified we then attempt to authenticate to the remote host too.
func (*IMAPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type K8SSvcTest ¶
type K8SSvcTest struct { }
K8SSvcTest is our object.
func (*K8SSvcTest) Arguments ¶
func (s *K8SSvcTest) Arguments() map[string]string
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*K8SSvcTest) Example ¶
func (s *K8SSvcTest) Example() string
Example returns sample usage-instructions for self-documentation purposes.
func (*K8SSvcTest) GetUniqueHashForTest ¶
func (*K8SSvcTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
func (*K8SSvcTest) ShouldResolveHostname ¶
func (s *K8SSvcTest) ShouldResolveHostname() bool
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type MYSQLTest ¶
type MYSQLTest struct { }
MYSQLTest is our object
func (*MYSQLTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*MYSQLTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*MYSQLTest) GetUniqueHashForTest ¶
func (*MYSQLTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection to the host and attempt to login with the specified username & password.
func (*MYSQLTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type NNTPTest ¶
type NNTPTest struct { }
NNTPTest is our object.
func (*NNTPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*NNTPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*NNTPTest) GetUniqueHashForTest ¶
func (*NNTPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 119, and look for a response which appears to be an NNTP-server.
func (*NNTPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type PINGTest ¶
type PINGTest struct { }
PINGTest is our object.
func (*PINGTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*PINGTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*PINGTest) GetUniqueHashForTest ¶
func (*PINGTest) Ping4 ¶
Ping4 runs a ping test against an IPv4 address, returning true if the ping succeeded.
func (*PINGTest) Ping6 ¶
Ping6 runs a ping test against an IPv6 address, returning true if the ping succeeded.
func (*PINGTest) RunCommand ¶
func (s *PINGTest) RunCommand(name string, args ...string) (stdout string, stderr string, exitCode int)
RunCommand invokes an external binary and returns stdout/stderr/exit-code
func (*PINGTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we run a ping-command with the appropriate binary depending on the address-family of the target host.
func (*PINGTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type POP3STest ¶
type POP3STest struct { }
POP3STest is our object
func (*POP3STest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*POP3STest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*POP3STest) GetUniqueHashForTest ¶
func (*POP3STest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a POP3 connection to the specified host, and if a username + password were specified we then attempt to authenticate to the remote host too.
func (*POP3STest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type POP3Test ¶
type POP3Test struct { }
POP3Test is our object
func (*POP3Test) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*POP3Test) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*POP3Test) GetUniqueHashForTest ¶
func (*POP3Test) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a POP3 connection to the specified host, and if a username + password were specified we then attempt to authenticate to the remote host too.
func (*POP3Test) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type PSQLTest ¶
type PSQLTest struct { }
PSQLTest is our object
func (*PSQLTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*PSQLTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*PSQLTest) GetUniqueHashForTest ¶
func (*PSQLTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection to the database host and attempt to login with the specified username & password.
func (*PSQLTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type ProtocolTest ¶
type ProtocolTest interface { // // Arguments return the arguments which this protocol-test, along // with a regular expression which will be used to validate a non-empty // argument. // Arguments() map[string]string // Example should return a string describing how your protocol-test // works and is invoked. // // Optional arguments will automatically be documented. Example() string // // // RunTest actually invokes the protocol-handler to run its // tests. // // Return a suitable error if the test fails, or nil to indicate // it passed. // RunTest(tst test.Test, target string, opts test.Options) error ShouldResolveHostname() bool GetUniqueHashForTest(tst test.Test, opts test.Options) *string }
ProtocolTest interface is the core of our code, it defines the implementation methods which must be implemented to add a new protocol-test.
func ProtocolHandler ¶
func ProtocolHandler(id string) (a ProtocolTest)
ProtocolHandler is the factory-method which looks up and returns an object of the given type - if possible.
type REDISTest ¶
type REDISTest struct { }
REDISTest is our object
func (*REDISTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*REDISTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*REDISTest) GetUniqueHashForTest ¶
func (*REDISTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a Redis-test against the given target.
func (*REDISTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type RSYNCTest ¶
type RSYNCTest struct { }
RSYNCTest is our object.
func (*RSYNCTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*RSYNCTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*RSYNCTest) GetUniqueHashForTest ¶
func (*RSYNCTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 873, and look for a response which appears to be an rsync-server.
func (*RSYNCTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type SMTPTest ¶
type SMTPTest struct { }
SMTPTest is our object
func (*SMTPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*SMTPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*SMTPTest) GetUniqueHashForTest ¶
func (*SMTPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 25, and look for a response which appears to be an SMTP-server.
func (*SMTPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type SSHTest ¶
type SSHTest struct { }
SSHTest is our object.
func (*SSHTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*SSHTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*SSHTest) GetUniqueHashForTest ¶
func (*SSHTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 22, and look for a response which appears to be an SSH-server.
func (*SSHTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type SSLTest ¶
type SSLTest struct { }
SSLTest is our object.
func (*SSLTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*SSLTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*SSLTest) GetUniqueHashForTest ¶
func (*SSLTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a SSL-test against the given URL.
For the purposes of clarity this test makes a TCP dial and verifies SSL certificates validity. The `test.Test` structure contains our raw test, and the `target` variable contains the IP address against which to make the request.
So:
tst.Target => "steve.kemp.fi target => "176.9.183.100"
func (*SSLTest) SSLExpiration ¶
SSLExpiration returns the number of hours remaining for a given SSL certificate chain.
func (*SSLTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type TCPTest ¶
type TCPTest struct { }
TCPTest is our object
func (*TCPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*TCPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*TCPTest) GetUniqueHashForTest ¶
func (*TCPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection to the specified port, and assume that everything is OK if that succeeded.
func (*TCPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type TELNETTest ¶
type TELNETTest struct { }
TELNETTest is our object
func (*TELNETTest) Arguments ¶
func (s *TELNETTest) Arguments() map[string]string
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*TELNETTest) Example ¶
func (s *TELNETTest) Example() string
Example returns sample usage-instructions for self-documentation purposes.
func (*TELNETTest) GetUniqueHashForTest ¶
func (*TELNETTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection to the specified port, and assume that everything is OK if that succeeded.
func (*TELNETTest) ShouldResolveHostname ¶
func (s *TELNETTest) ShouldResolveHostname() bool
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type TestCtor ¶
type TestCtor func() ProtocolTest
TestCtor is the signature of a constructor-function.
type VNCTest ¶
type VNCTest struct { }
VNCTest is our object
func (*VNCTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*VNCTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*VNCTest) GetUniqueHashForTest ¶
func (*VNCTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 5900, and look for a response which appears to be an VNC-server.
func (*VNCTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
type XMPPTest ¶
type XMPPTest struct { }
XMPPTest is our object
func (*XMPPTest) Arguments ¶
Arguments returns the names of arguments which this protocol-test understands, along with corresponding regular-expressions to validate their values.
func (*XMPPTest) Example ¶
Example returns sample usage-instructions for self-documentation purposes.
func (*XMPPTest) GetUniqueHashForTest ¶
func (*XMPPTest) RunTest ¶
RunTest is the part of our API which is invoked to actually execute a test against the given target.
In this case we make a TCP connection, defaulting to port 5222, and look for a response which appears to be an XMPP-server.
func (*XMPPTest) ShouldResolveHostname ¶
ShouldResolveHostname returns if this protocol requires the hostname resolution of the first test argument
Source Files ¶
- api.go
- dns_probe.go
- dumb_probe.go
- finger_probe.go
- ftp_probe.go
- http_probe.go
- imap_probe.go
- imaps_probe.go
- k8s_svc_probe.go
- mysql_probe.go
- nntp_probe.go
- ping_probe.go
- pop3_probe.go
- pop3s_probe.go
- psql_probe.go
- redis_probe.go
- rsync_probe.go
- smtp_probe.go
- ssh_probe.go
- ssl_probe.go
- tcp_probe.go
- telnet_probe.go
- vnc_probe.go
- xmpp_probe.go