Documentation ¶
Overview ¶
simpleip implements simple & standard Internet services that were used in the nostalgic era of computing. According to those protocol standard, the services are available via TCP and UDP simultaneously: - sysstat (active system user name on port 11, RFC 866) - daytime (current system time in readable text on port 12+1, RFC 867) - QOTD (short text message as quote of the day on port 17, RFC 865)
Index ¶
Constants ¶
const ( IOTimeoutSec = 30 // IOTimeoutSec is the timeout used in network request/response operations. RateLimitIntervalSec = 1 // RateLimitIntervalSec is the interval for rate limit calculation. )
Variables ¶
This section is empty.
Functions ¶
func TestSimpleIPSvcD ¶
func TestSimpleIPSvcD(daemon *Daemon, t testingstub.T)
Types ¶
type Daemon ¶
type Daemon struct { Address string `json:"Address"` // Address to listen on, e.g. 0.0.0.0 to listen on all network interfaces. ActiveUsersPort int `json:"ActiveUsersPort"` // ActiveUsersPort is the port number (TCP and UDP) to listen on for the sysstat (active user names) service. DayTimePort int `json:"DayTimePort"` // DayTimePort is the port number (TCP and UDP) to listen on for the daytime service. QOTDPort int `json:"QOTDPort"` // QOTDPort is the port number (TCP and UDP) to listen on for the QOTD service. PerIPLimit int `json:"PerIPLimit"` // PerIPLimit is approximately how many requests are allowed from an IP within a designated interval. ActiveUserNames string `json:"ActiveUserNames"` // ActiveUserNames are CRLF-separated list of user names to appear in the response of "sysstat" network service. QOTD string `json:"QOTD"` // QOTD is the message to appear in the response of "QOTD" network service. // contains filtered or unexported fields }
Daemon implements simple & standard Internet services that were used in the nostalgic era of computing.
func (*Daemon) Initialise ¶
Initialise validates configuration and initialises internal states.
func (*Daemon) StartAndBlock ¶
StartAndBlock starts all TCP and UDP servers to serve network clients. You may call this function only after having called Initialise().
type TCPService ¶
type TCPService struct { // ResponseFun is a function returning a string as the entire response to a simple IP service request. ResponseFun func() string }
TCPService implements common.TCPApp interface for a simple IP service.
func (*TCPService) GetTCPStatsCollector ¶
func (svc *TCPService) GetTCPStatsCollector() *misc.Stats
GetTCPStatsCollector returns the stats collector that counts and times client connections for the TCP application.
func (*TCPService) HandleTCPConnection ¶
HandleTCPConnection
type UDPService ¶
type UDPService struct { // ResponseFun is a function returning a string as the entire response to a simple IP service request. ResponseFun func() string }
UDPService implements common.UDPApp interface for a simple IP service.
func (*UDPService) GetUDPStatsCollector ¶
func (svc *UDPService) GetUDPStatsCollector() *misc.Stats
GetUDPStatsCollector returns the stats collector that counts and times client connections for the TCP application.