Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoshidan/go-stun
STUN (Session Traversal Utilities for NATs) Server.
https://github.com/yoshidan/go-stun
golang stun
Last synced: 3 months ago
JSON representation
STUN (Session Traversal Utilities for NATs) Server.
- Host: GitHub
- URL: https://github.com/yoshidan/go-stun
- Owner: yoshidan
- License: mit
- Created: 2020-11-12T05:19:01.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-13T02:09:05.000Z (about 4 years ago)
- Last Synced: 2024-06-20T12:51:43.078Z (7 months ago)
- Topics: golang, stun
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-stun
* STUN (Session Traversal Utilities for NATs) Server.
* [RFC 5389](https://tools.ietf.org/html/rfc5389)
* Only `Binding Request` is supported.## Requirement
* Go 1.15
## Server
```
go run cmd/server/main.go
``````
go build cmd/server/main.go
./main
```If you run on docker or GKE `--network=host` is required.
## Client
```go
import "github.com/yoshidan/go-stun/stun"// discover once
func onetime() {
client := stun.NewClient(context.Background(), "stun.l.google.com:19302", nil)
addr, err := client.Discover()
}// keep alive
func keepalive() {
client := stun.NewClient(context.Background(), "stun.l.google.com:19302", nil)
err := client.Keepalive()
if err !=nil {
// handle err
}
defer client.Close()addr, err := client.Discover()
//reuse connection
addr2, err2 := client.Discover()
}
```