Skip to content

pixelbender/go-stun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-stun

Go implementation of STUN, TURN and ICE Protocols

Build Status Coverage Status Go Report Card GoDoc

Features

  • 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
  • ...

Installation

go get github.com/pixelbender/go-stun/...

STUN: Server reflexive transport address discovery

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)
}

TURN: Relayed transport address allocation

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())
}

Specifications

About

Go implementation of STUN, TURN and ICE Protocols

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages