Skip to content
/ rndz-go Public

A simple rendezvous protocol implementation to help NAT traversal or hole punching.

License

Notifications You must be signed in to change notification settings

optman/rndz-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rndz-go

A simple rendezvous protocol implementation to help NAT traversal or hole punching.

Golang implementation for rndz.

Table of Contents

Features

  • Simple and lightweight implementation
  • Supports both TCP and UDP protocols
  • Easy to integrate with existing Go projects

Installation

To install rndz-go, use go get:

go get github.com/optman/rndz-go

Usage

Here's how you can use rndz-go to perform NAT traversal or hole punching.

TCP

Client 1

import (
	"context"
	"net/netip"

	"github.com/optman/rndz-go/client/tcp"
)

func main() {
	rndzServer := "your-rendezvous-server"
	c := tcp.NewClient(rndzServer, "c1", netip.AddrPort{})
	defer c.Close()
	l, _ := c.Listen(context.Background())
	defer l.Close()
	for {
		conn, _ := l.Accept()
		defer conn.Close()
		// Handle connection
	}
}

Client 2

import (
	"context"
	"net/netip"

	"github.com/optman/rndz-go/client/tcp"
)

func main() {
	rndzServer := "your-rendezvous-server"
	c := tcp.NewClient(rndzServer, "c2", netip.AddrPort{})
	defer c.Close()
	conn, _ := c.Connect(context.Background(), "c1")
	defer conn.Close()
	// Use connection
}

UDP

import (
	"net/netip"

	"github.com/optman/rndz-go/client/udp"
)

func main() {
	rndzServer := "your-rendezvous-server"
	id := "your-client-id"
	c := udp.NewClient(rndzServer, id, netip.AddrPort{})
	// Use client
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A simple rendezvous protocol implementation to help NAT traversal or hole punching.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages