2017-07-04 06:39:18 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-10-28 03:01:03 +03:00
|
|
|
"log"
|
2017-07-04 06:39:18 +03:00
|
|
|
|
2017-10-29 00:58:59 +03:00
|
|
|
"github.com/tidwall/evio"
|
2017-07-04 06:39:18 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2017-10-29 00:58:59 +03:00
|
|
|
var events evio.Events
|
2017-10-28 03:01:03 +03:00
|
|
|
|
2017-10-29 00:58:59 +03:00
|
|
|
events.Serving = func(wake func(id int) bool) (action evio.Action) {
|
2017-10-28 03:01:03 +03:00
|
|
|
log.Print("echo server started on port 5000")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-10-29 00:58:59 +03:00
|
|
|
events.Data = func(id int, in []byte) (out []byte, action evio.Action) {
|
2017-10-28 03:01:03 +03:00
|
|
|
out = in
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-10-29 00:58:59 +03:00
|
|
|
log.Fatal(evio.Serve(events, "tcp://0.0.0.0:5000"))
|
2017-07-04 06:39:18 +03:00
|
|
|
}
|