Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDisconnectedError ¶
IsDisconnectedError returns true if the given error is related to a disconnected socket.
func ParseAddress ¶
ParseAddress takes an address and tries to extract the protocol from it. Protocols may be prepended by the "protocol://" notation. If no protocol is given, defaultProtocol is returned. The first parameter returned is the address, the second denotes the protocol. The protocol is allways returned as lowercase string. If only a number is given as an address the number is assumed to be a port. As of this "80" and ":80" will return ":80" as the address.
func SplitAddress ¶
func SplitAddress(addressString string, defaultProtocol string) (protocol, host, port string, err error)
SplitAddress splits an address of the form "protocol://host:port" into its components. If no protocol is given, defaultProtocol is used. This function uses net.SplitHostPort and ParseAddress.
Types ¶
type StopListener ¶
type StopListener struct { *net.TCPListener // contains filtered or unexported fields }
StopListener is a wrapper around net.TCPListener that allows to gracefully shut down a connection loop.
func NewStopListener ¶
func NewStopListener(address string) (*StopListener, error)
NewStopListener creates a new, stoppable TCP server connection. Address needs to be cmpliant to net.Listen.
func (*StopListener) Accept ¶
func (listen *StopListener) Accept() (net.Conn, error)
Accept is analogous to net.TCPListener.Accept but may return a connection closed error if the connection was requested to shut down.
func (*StopListener) Close ¶
func (listen *StopListener) Close() error
Close requests a connection close on this listener
type StopRequestError ¶
type StopRequestError struct{}
StopRequestError is not an error but a note that the connection was requested to be closed.
func (StopRequestError) Error ¶
func (err StopRequestError) Error() string
Error implements the standard error interface