Go implementation of STUN, TURN and ICE Protocols
- STUN Encoder/Decoder
- STUN Client/Server
- STUN Authorization
- STUN Transactions
- STUN Multiplexing
- STUN Redirection
- NAT Behavior Discovery
- ICE Messages
- ICE Agent
- ICE Gathering
- ICE Lite
- TURN Messages
- TURN Client
- TURN Server
- ...
go get github.com/pixelbender/go-stun/...
package main
import (
"github.com/pixelbender/go-stun/stun"
"fmt"
)
func main() {
conn, addr, err := stun.Discover("stun:stun.l.google.com:19302")
if err != nil {
fmt.Println(err)
return
}
defer conn.Close()
fmt.Printf("Local address: %v, Server reflexive address: %v", conn.LocalAddr(), addr)
}
package main
import (
"github.com/pixelbender/go-stun/turn"
"fmt"
)
func main() {
conn, err := turn.Allocate("turn:username:[email protected]")
if err != nil {
fmt.Println(err)
return
}
defer conn.Close()
fmt.Printf("Local address: %v, Relayed transport address: %v", conn.LocalAddr(), conn.RelayedAddr())
}