mvnet

module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT

README

mvnet

CI Go Reference

mvnet is a collection of standard-library-only Go networking utilities for NAT traversal, hole punching, and connectivity testing. Each package can be imported independently, so applications only need to adopt the pieces they use.

Requirements

  • Go 1.24 or newer
  • No third-party runtime dependencies

Installation

go get github.com/mainvec/mvnet@latest

Then import the package you need. For example:

package main

import (
	"context"
	"fmt"

	"github.com/mainvec/mvnet/stun"
)

func main() {
	result, err := stun.QuerySTUNServer("stun.l.google.com:19302")
	if err != nil {
		fmt.Println("STUN query failed:", err)
		return
	}
	fmt.Printf("Public address: %s\n", result.PublicAddr)
}

Packages

Package Purpose
stun Minimal STUN (RFC 5389) client — discovers the public reflexive address.
nat Detects NAT behavior (Open, Easy, Hard, Symmetric, Blocked) and recommends traversal strategies.
hpunch High-level hole puncher — auto-detects NAT type, then performs UDP hole punching.
punch Full state-machine UDP hole-punching protocol with handshake, keepalive, and connection verification.
ice ICE (Interactive Connectivity Establishment) agent — gathers candidates, runs STUN checks, nominates best pair.
upnp UPnP-IGD and NAT-PMP client — discovers gateway, adds/removes port mappings.
speedtest Bidirectional throughput benchmark over an established connection.

API details and examples are available on pkg.go.dev.

Stability

The project currently uses v0 releases. APIs may change between minor versions until v1.0.0; release tags follow semantic versioning.

Contributing

See CONTRIBUTING.md for the development workflow and required checks. Please report security issues according to SECURITY.md.

License

This project is available under the MIT License.

Directories

Path Synopsis
cmd/hpunch command
Package ice implements ICE (Interactive Connectivity Establishment) for NAT traversal.
Package ice implements ICE (Interactive Connectivity Establishment) for NAT traversal.
nat
cmd/natdetect command
cmd/punch command
cmd/speedtest command
cmd command
cmd/upnp command

Jump to

Keyboard shortcuts

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