Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilgooz/bon
Routing capability for your net.Conn's like you do with for your http handlers.
https://github.com/ilgooz/bon
connection net routing yamux
Last synced: 3 months ago
JSON representation
Routing capability for your net.Conn's like you do with for your http handlers.
- Host: GitHub
- URL: https://github.com/ilgooz/bon
- Owner: ilgooz
- License: mit
- Created: 2018-06-30T15:26:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-03T07:32:58.000Z (over 6 years ago)
- Last Synced: 2024-06-20T03:44:14.147Z (7 months ago)
- Topics: connection, net, routing, yamux
- Language: Go
- Size: 10.7 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# bon [![GoDoc](https://godoc.org/github.com/ilgooz/bon?status.svg)](https://godoc.org/github.com/ilgooz/bon) [![Go Report Card](https://goreportcard.com/badge/github.com/ilgooz/bon)](https://goreportcard.com/report/github.com/ilgooz/bon) [![Build Status](https://travis-ci.org/ilgooz/bon.svg?branch=master)](https://travis-ci.org/ilgooz/bon)
Bon provides routing capability for your net.Conn's like you do with for your
http handlers. It can both accept and open connections like described in Transporter.
Thus, you can both Connect to a route and invoke a handler of one when requested by others.See [Transporter](https://godoc.org/github.com/ilgooz/bon/#Transporter) to implement your own net.Conn provider.
```
go get gopkg.in/ilgooz/bon.v1
```
## Usage```go
const (
// Define your routes.
GRPCConn bon.Route = 1 << iota
)remoteService := bon.New(remoteServiceTransporter)
remoteService.Handle(GRPCConn, func(conn net.Conn){
// do domething with your conn...
})
go remoteService.Run()service := bon.New(serviceTransporter)
conn, err := service.Connect(GRPCConn)
// do domething with your conn...
```