Skip to content

STUN (Session Traversal Utilities for NATs) Server.

License

Notifications You must be signed in to change notification settings

yoshidan/go-stun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-stun

  • STUN (Session Traversal Utilities for NATs) Server.

  • RFC 5389
  • 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

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

About

STUN (Session Traversal Utilities for NATs) Server.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages