Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyNet

Secure, zero-config peer-to-peer and relay-assisted Virtual Private Network (VPN/LAN) tool.

Version License Platform Language Publisher


Overview

MyNet is an open-source, self-hosted VPN application written in Go by CrosMakesGames. It creates a secure virtual private network that connects computers across firewalls, double NATs, and strict network environments using MyNet-assigned virtual IP addresses (100.64.0.0/10). With MyNet, you can easily host LAN games, SSH into remote machines, ping virtual peers, and share local services across devices without requiring public IPs or complex router configurations.


Features

  • Relay-First NAT Traversal: Connect instantly through NATs and firewalls using the official default relay server (relay-na1.crosmakesgames.com).
  • Direct P2P Mode: Opt-in high-performance peer-to-peer networking with automatic UPnP port forwarding and STUN hole-punching.
  • Zero Configuration: Get up and running in seconds with auto-generated 6-character network codes (e.g., ABC123).
  • Cross-Platform: Full support for Windows (WinTun driver interface) and Linux (/dev/net/tun) on amd64 architecture.
  • Comprehensive Device & Access Management: Real-time connection status monitoring, virtual IP assignment, device listing, network pinging, direct SSH helper, and administrative device promotion/demotion.
  • Robust Security: Enforce join passwords, ban or unban unauthorized devices, and restrict administrative commands.
  • Daemon & Background Mode: Run host and join sessions silently in the background (--daemon, --quiet).
  • Native System Service Integration: Install seamlessly as a background system service on Linux (systemd) or Windows (sc.exe / NSIS installer).
  • Automated Deployment: Ready-to-use PowerShell and Shell scripts (deploy-and-join.ps1, install-linux.sh --quiet --yes) for unattended IT and server installations.
  • Custom Relay Hosting: Standalone mynet-relay binary included to host custom relay servers on public VPS nodes.

Quick Start

Connect two devices in under 30 seconds:

1. Host a Network (Relay Mode — Default)

Run the host command on Machine A:

mynet host relay

Outputs a 6-character network code (e.g. ABC123) using the default relay relay-na1.crosmakesgames.com:8443.

2. Join the Network

Run the join command on Machine B:

mynet join relay ABC123

3. Verify Connection

Check assigned IP and active peers:

mynet ip         # Shows your virtual IP (e.g. 100.64.0.2)
mynet devices    # Lists all connected devices on the VPN
mynet ping 100.64.0.1  # Ping host device

Installation

MyNet offers 3 flexible installation methods for Linux and Windows.

Method 1: Portable Binaries (Just Download and Run)

Download pre-compiled binaries for your operating system:

  • Linux (amd64):
    chmod +x mynet mynet-relay
    sudo ./mynet help
  • Windows (amd64): Open PowerShell or Command Prompt as Administrator and run:
    .\mynet.exe help

Method 2: Installer Scripts & GUI Wizard

Linux Shell Installer

Run the automated shell installer script:

sudo ./install-linux.sh

Copies mynet and mynet-relay binaries to /usr/local/bin, creates /etc/mynet and /var/lib/mynet directories, and optionally configures systemd services.

Windows GUI Installer

Double-click MyNet-Setup.exe to launch the step-by-step NSIS Setup Wizard:

  1. Welcome & License Agreement
  2. Select Components: MyNet CLI, MyNet Relay Server, Windows Service, Desktop Shortcut
  3. Choose Installation Directory (Default: C:\Program Files\MyNet)
  4. Finish install — mynet is automatically added to system PATH.

Windows PowerShell Installer

Run from an elevated PowerShell window:

# Interactive installation
.\install-windows.ps1

# Install everything silently (Relay + Windows Service + Desktop Shortcut)
.\install-windows.ps1 -Silent -Relay -Service -Desktop

Method 3: Build from Source

Prerequisites: Go 1.21 or higher, make build utility, and makensis (optional, for Windows setup wizard).

git clone https://github.com/crosmakesgames/mynet.git
cd mynet/source

# Build all binaries for Windows and Linux
make all

# Target-specific build commands:
make build-linux    # Builds Linux amd64 binaries in bin/
make build-windows  # Builds Windows amd64 binaries in bin/
make installer      # Builds Windows NSIS installer (MyNet-Setup.exe)
make package        # Builds binaries and bundles release ZIP archive
make test           # Runs unit test suite
make clean          # Removes build artifacts

Usage Guide

Hosting a Network

Relay Mode (Default)

Host a network using the default relay server without opening ports:

mynet host relay

To specify a custom relay server address:

mynet host relay relay-na1.crosmakesgames.com:8443

To set a custom server name and join password when hosting:

mynet host relay --name "MyGameServer" --password "SecretPass123"

Direct P2P Mode

Host a direct peer-to-peer network (requires port forwarding TCP 8443 and UDP 8444, or UPnP support):

mynet start p2p

Joining a Network

Join via Relay Mode

mynet join relay ABC123

Join using a specific relay address or password:

mynet join relay ABC123 relay-na1.crosmakesgames.com:8443 --password "SecretPass123" --name "LaptopClient"

Join via Direct P2P Mode

mynet join p2p 192.168.1.50

Specify custom host port or password:

mynet join p2p 203.0.113.5:8443 --password "SecretPass123"

Managing Devices & Connections

Task Command Description
Check Status mynet status Displays active connection, role, and relay details.
Show Virtual IP mynet ip Prints your assigned CGNAT virtual IP (100.64.0.x).
List Devices mynet devices Lists all active peers, host status, and virtual IPs.
Ping Peer mynet ping <ip> Tests network connectivity and latency to a peer.
SSH Helper mynet ssh <user@ip> Opens SSH connection to a peer over the VPN.
Stop Hosting mynet stop Stops hosting the active network session.
Leave Network mynet leave Disconnects client from the joined network.
Full Cleanup mynet remove Stops session, disconnects, and clears firewall rules.

Security & Access Control

Password Protection

While hosting, require joiners to authenticate:

# Set join password on active network
mynet password set MySecurePassword

# Disable password requirement
mynet password off

Device Banning & Administrative Promotion

Hosts and network admins can manage connected devices using device IDs:

# Ban a device from the network
mynet ban <device_id>

# Unban a previously blocked device
mynet unban <device_id>

# Promote a connected device to network admin
mynet promote <device_id>

# Demote an admin device back to standard client
mynet demote <device_id>

Daemon Mode & Quiet Execution

Run commands in the background without blocking terminal sessions:

  • --daemon / -d: Detaches process to run in background.
  • --quiet / -q: Silences output and automatically confirms relay prompts using relay-na1.crosmakesgames.com:8443.

Examples:

# Host in background quietly
mynet host relay --daemon --quiet

# Join network in background
mynet join relay ABC123 -d -q

System Service Setup

Set up MyNet to run continuously as a system background service that auto-starts on system boot.

Linux (systemd)

Installation & Enable

# Install MyNet as systemd service
sudo mynet install

# Or install silently during script setup
sudo ./install-linux.sh --yes

Service Management Commands

sudo systemctl start mynet       # Start MyNet service
sudo systemctl stop mynet        # Stop MyNet service
sudo systemctl restart mynet     # Restart MyNet service
sudo systemctl enable mynet      # Enable auto-start on boot
sudo systemctl status mynet      # Check status
sudo journalctl -u mynet -f      # View real-time logs

Service file created at /etc/systemd/system/mynet.service.

Windows (sc.exe / Installer)

Installation

  • GUI Installer: Select Windows Service during installation via MyNet-Setup.exe.
  • PowerShell / CLI:
    mynet install --quiet
    # or
    .\install-windows.ps1 -Silent -Service

Service Management Commands

Run from PowerShell / CMD as Administrator:

sc.exe start MyNet      # Start MyNet service
sc.exe stop MyNet       # Stop MyNet service
sc.exe query MyNet      # Query status

Silent & Automated Deployment

MyNet includes dedicated scripts for automated IT provisioning and headless deployments.

Linux Automated Installation

# Fully automated, silent full installation (binaries + systemd services)
sudo ./install-linux.sh --quiet --yes

# Binaries-only installation without services
sudo ./install-linux.sh --quiet --no

Windows Automated & Silent Deployment

PowerShell Installer Options

# Silent installation to default directory
.\install-windows.ps1 -Silent

# Silent full install with desktop shortcut & service
.\install-windows.ps1 -Silent -Relay -Service -Desktop

# Custom install directory
.\install-windows.ps1 -Silent -InstallDir "C:\Tools\MyNet"

One-Shot Deploy & Join Script (deploy-and-join.ps1)

Downloads the latest release from GitHub, installs silently, installs system service, and joins a network in one command:

powershell -ExecutionPolicy Bypass -File .\deploy-and-join.ps1 `
           -NetworkCode "ABC123" `
           -RelayAddr "relay-na1.crosmakesgames.com:8443" `
           -Password "SecretPass" `
           -AsService `
           -Daemon

Modular Silent Deployment Scripts (in installers/)

  • 1_silent_install_from_github.ps1: Fetches latest setup executable from GitHub and runs /S silent install.
  • 2_silent_join_relay.ps1 -NetworkCode "ABC123": Joins relay network in silent mode.
  • 3_full_deploy.ps1 -NetworkCode "ABC123": Downloads, installs, and connects silently in one sequence.

Running a Relay Server

To run your own public or private MyNet relay server, use the standalone mynet-relay binary on a machine with a public IP address (TCP 8443 and UDP 8444).

Quick Launch

# Start relay server (default: max 50 networks, TCP 8443, UDP 8444)
mynet-relay host

# Custom capacity and ports
mynet-relay host 100 --addr 0.0.0.0 --port 8443 --data-port 8444 --daemon

VPS Automated Setup Script

On a Linux VPS, run the automated setup script to open firewall ports (ufw / firewalld / iptables) and register the mynet-relay systemd service:

sudo ./setup-relay.sh --max-networks 100

For complete relay configuration details and production hardening, visit mynet.crosmakesgames.com/website/relay/.


Uninstall Instructions

Linux

Interactive / Automated Script

# Interactive uninstaller
sudo ./uninstall-linux.sh

# Complete silent purge (removes binaries, services, config /etc/mynet, data /var/lib/mynet)
sudo ./uninstall-linux.sh -y --purge

CLI Uninstall Command

sudo mynet uninstall --full

Windows

GUI Uninstaller

Go to Settings > Apps > Installed Apps and select MyNet, or run Uninstall.exe in C:\Program Files\MyNet.

PowerShell Installer Uninstaller

# Interactive uninstall
.\install-windows.ps1 -Uninstall

# Silent full purge (removes binaries, service, PATH entries, registry, and ProgramData)
.\install-windows.ps1 -Uninstall -Silent -Purge

CLI Uninstall Command

mynet uninstall --full

CLI Reference

Normal Application (mynet)

Command Arguments / Flags Description
mynet host relay [relay_addr] [--name <name>] [--password <pw>] [--daemon/-d] [--quiet/-q] Host network via relay server (default: relay-na1.crosmakesgames.com:8443).
mynet start p2p [--name <name>] [--password <pw>] [--daemon/-d] [--quiet/-q] Host direct P2P network (requires port forwarding / UPnP).
mynet join relay <code> [relay_addr] [--password <pw>] [--name <name>] [--daemon/-d] [--quiet/-q] Join network via relay code.
mynet join p2p <ip[:port]> [--password <pw>] [--name <name>] [--daemon/-d] [--quiet/-q] Join direct P2P host.
mynet stop None Stop hosting current network.
mynet leave None Disconnect from joined network.
mynet remove None Stop session, disconnect, and clear firewall rules.
mynet status None Show active network connection status and role.
mynet ip None Display assigned virtual IP address (100.64.0.x).
mynet devices None List all devices on the virtual network.
mynet ping <ip> Ping virtual IP address of a VPN peer.
mynet ssh <user@ip> Open SSH terminal session to virtual IP peer.
mynet password set <password> Require password authentication for joining.
mynet password off None Disable join password requirement.
mynet ban <device_id> Ban device from current network.
mynet unban <device_id> Unban device.
mynet promote <device_id> Promote connected device to admin.
mynet demote <device_id> Demote admin device to client.
mynet install [--quiet/-q] Install MyNet as system service.
mynet uninstall [--full] [--quiet/-q] Uninstall system service (--full removes files, PATH, registry).
mynet version None Display version information.
mynet help None Display CLI help menu.

Relay Host Application (mynet-relay)

Command Arguments / Flags Description
mynet-relay host [max_nets] [--addr <addr>] [--port <port>] [--data-port <port>] [--daemon/-d] [--quiet/-q] Run relay server (default: 50 networks max, 0.0.0.0:8443 TCP, 8444 UDP).
mynet-relay stop None Stop running relay server daemon.
mynet-relay remove None Stop relay server and clean up firewall rules.
mynet-relay status None Check relay server status and listening ports.
mynet-relay install [--quiet/-q] Install relay server as system service.
mynet-relay uninstall None Remove relay server system service.
mynet-relay version None Display relay version information.
mynet-relay help None Display relay CLI help menu.

Configuration

MyNet stores JSON configuration files and state databases in platform-standard directory locations:

File Paths

OS Platform Component Location
Windows System Config Dir C:\ProgramData\MyNet\
Client Config File C:\ProgramData\MyNet\client.json
Server Config File C:\ProgramData\MyNet\server.json
SQLite Database C:\ProgramData\MyNet\server.db
Client State File C:\ProgramData\MyNet\client_state.json
Daemon Logs C:\ProgramData\MyNet\client.log, server.log, relay.log
Linux Config Directory /etc/mynet/
Client Config File /etc/mynet/client.json
Server Config File /etc/mynet/server.json
Data Directory /var/lib/mynet/
SQLite Database /var/lib/mynet/server.db
Client State File /var/lib/mynet/client_state.json
Daemon Logs /var/lib/mynet/client.log, server.log, relay.log

Configuration Schemas

Client Configuration (client.json)

{
  "server_addr": "relay-na1.crosmakesgames.com:8443",
  "password": "",
  "device_name": "MyDesktop",
  "data_dir": "/var/lib/mynet"
}

Server Configuration (server.json)

{
  "name": "mynet",
  "bind_addr": "0.0.0.0",
  "control_port": 8443,
  "data_port": 8444,
  "enable_password": false,
  "network_cidr": "100.64.0.0/10",
  "data_dir": "/var/lib/mynet"
}

Frequently Asked Questions (FAQ)

Q: Do I need to forward ports on my router to host or join?

No. By default, MyNet uses relay mode (mynet host relay), which connects outbound to relay-na1.crosmakesgames.com:8443. Port forwarding is only necessary if you explicitly choose direct P2P mode (mynet start p2p).

Q: What virtual IP range does MyNet allocate?

MyNet uses the 100.64.0.0/10 CGNAT block (RFC 6598). This range is specifically designed to avoid IP conflicts with home or enterprise LAN subnets (192.168.x.x or 10.x.x.x).

Q: Can MyNet automatically reconnect on system startup?

Yes. Installing MyNet as a system service (mynet install on Linux or Windows) enables auto-start behavior on system boot.

Q: Is my network traffic encrypted?

Yes. Control channels and data packets transmitted over MyNet VPN virtual interfaces are authenticated and encrypted.

Q: Is there a limit to how many devices can join a single network?

Networks support multiple concurrent clients. When hosting via relay, the relay server allows up to its configured max network capacity.


License

MyNet is open-source software published by CrosMakesGames and licensed under the MIT License. See LICENSE.txt for full license details.


Links

About

IN DEV. NOT FINISHED. READ README/RELEASES.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages