modulepackage
0.0.0-20190926084040-127aab0e5233
Repository: https://github.com/0987363/tcp_server.git
Documentation: pkg.go.dev
# README
TS
Package tcp_server created to help build TCP/UDP servers faster. support tcp/udp/middleware.
Install package
go get github.com/0987363/tcp_server@master
Usage:
package main
import ts "github.com/0987363/tcp_server"
func main() {
server := ts.New("localhost:9999")
server.SetUdpProc(1)
server.Use(func(c *ts.Context) {
c.Set("logger", "logggg")
c.Next()
})
server.OnNewMessage(func(c *ts.Context) {
message := c.ReadData()
v, ok := c.Get("logger")
c.Trim(len(message))
c.AbortWithError(errors.New("read failed."))
})
server.Listen()
}
# Packages
No description provided by the author
# Functions
No description provided by the author
Creates new tcp server instance.
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author