What is this?
vnet can establish virtual connections of client based on a native tcp connection from the front server.
Example
The Dial function connects to a server:
import "vnet"
conn, err := vnet.Dial("tcp", "127.0.0.1:8080")
if err != nil {
// handle error
}
// ...
The Listen function creates servers:
import "vnet"
ln, err := vnet.Listen("tcp", ":8080")
if err != nil {
// handle error
}
for {
conn, err := ln.Accept()
if err != nil {
// handle error
}
go handleConnection(conn)
}
Benchmark
cd this.repo.dir
go test -bench .