evnet
evnet copied to clipboard
⚡ Evnet is event-driven net framework with high performance deriving from gnet and evio.
⚡ Introduction

Evnet is event-driven net framework with high performance deriving from gnet and evio. It supports epoll syscall in Linux only now.
✨ Features
- [x] Supporting an event-driven mechanism: epoll on Linux.
- [ ] Supporting multiple protocols/IPC mechanism: TCP, UDP and Unix Domain Socket.
- [ ] Efficient, reusable and elastic memory buffer and zero copy.
- [ ] Supporting multiple load-balancing algorithms: Round-Robin, Source-Addr-Hash and Least-Connections
🎬 Getting started
go get github.com/bruce2233/evnet
type MyHandler struct {
BuiltinEventHandler
}
func (mh MyHandler) OnConn(c Conn) {
p, _ := c.Next(-1)
println(string(p))
}
func (mh MyHandler) OnClose(c Conn) {
println("On Close Trigger")
}
//main.go
func TestMainRec(t *testing.T) {
readHandler := MyHandler{BuiltinEventHandler{}}
Run(readHandler, "tcp://127.0.0.1:9000")
}