Documentation
¶
Overview ¶
lineserver emulates a line-based UDP server
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncReadline ¶
type AsyncReadline struct {
LineCh chan string // Lines read are written to this channel
ErrCh chan error // Error returned by ReadString is written to this channel (once).
*bufio.Reader
}
AsyncReadline provides a non-blocking version of bufio.Reader.ReadString('\n') using goroutines.
func NewAsyncReadline ¶
func NewAsyncReadline(r *bufio.Reader) *AsyncReadline
func (*AsyncReadline) Run ¶
func (r *AsyncReadline) Run()
type LineServer ¶
type LineServer struct {
Ch chan string
tomb.Tomb // provides: Done, Kill, Dying
// contains filtered or unexported fields
}
LineServer is a line-based UDP server à la `nc -u -l`. Ch channel will receive incoming lines from all clients.
func NewLineServer ¶
func NewLineServer(proto, addr string) (*LineServer, error)
func NewLineServerTCP ¶
func NewLineServerTCP(addr string) (*LineServer, error)
func NewLineServerUDP ¶
func NewLineServerUDP(addr string) (*LineServer, error)
func (*LineServer) GetUDPAddr ¶
func (srv *LineServer) GetUDPAddr() (*net.UDPAddr, error)
func (*LineServer) Start ¶
func (srv *LineServer) Start()
Click to show internal directories.
Click to hide internal directories.