Golang: STUN, TURN and ICE Protocols
![GoDoc](https://camo.githubusercontent.com/98385999e11aa9d29d538750b23f5cb96dff7f89b53edc9e6ba9672af05ac73d/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f706978656c62656e6465722f676f2d7374756e3f7374617475732e737667)
go get github.com/pixelbender/go-stun
STUN - Server reflexive transport address lookup
package main
import (
"github.com/pixelbender/go-stun/stun"
"fmt"
)
func main() {
addr, err := stun.Lookup("stun:stun.l.google.com:19302", "username", "password")
if err != nil {
fmt.Println(err)
} else {
fmt.Println(addr)
}
}
TURN - Relayed transport address allocation
package main
import (
"github.com/pixelbender/go-stun/turn"
"fmt"
)
func main() {
conn, err := turn.Allocate("turn:example.org", "username", "password")
if err != nil {
fmt.Println(err)
} else {
defer conn.Close()
fmt.Println(conn.RelayedAddr())
}
}