go-stun

module
v0.0.0-...-8728e54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2022 License: MIT

README

Golang: STUN, TURN and ICE Protocols

Build Status Coverage Status Go Report Card GoDoc

Features

  • STUN Message Encoder/Decoder
  • STUN Client/Server
  • STUN Authorization
  • STUN Redirect
  • STUN Service Discovery
  • ICE STUN Attributes
  • ICE STUN Errors
  • ICE Candidates gathering
  • ICE Lite
  • ICE SDP Attributes
  • TURN STUN Attributes
  • TURN STUN Errors
  • TURN Client
  • TURN Server
  • ...

Installation

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

Specifications

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL