/transporter-go

A library that abstracts the transport layer protocols

Primary LanguageGoMIT LicenseMIT

Transporter go

Release Coverage License GoDoc

A library that creates server abstracting the transport layer protocols

Supported protocols

Check out the CHANGELOG.

Downloading

go get github.com/ednailson/transporter-go

Creating a new server

server, _ := transporter.New("udp", "127.0.0.1", 3399)

It will create a UDP server on 127.0.0.1 at the 3399 port

The first parameter is the protocol, the library only supports tcp, tcp4, tcp6, udp, udp4 or udp6.

Reading messages

you need to create the handler function to handle the received requests.

After creating the server and the handler function, you just need to start listening to receive the messages.

//Printing all the received messages
fn := func(conn connection.Connection) {
	log.Println(string(conn.Message()))
}

//Starting to listen
_ = server.Listen(fn)

It will print all the received messages on the server

Closing the server

You just need to call the Close() function on the server

_ = server.Close()

Developer

Júnior Vilas Boas