goport

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 12 Imported by: 0

README

GoPort

Expose localhost. Instantly.

Make your local projects accessible from anywhere with a secure public URL — all with a single command.

Go PRs Welcome


What is GoPort?

GoPort is an open-source alternative to ngrok and jprq that turns local applications into publicly accessible HTTPS endpoints.

Whether you're testing webhooks, sharing a demo, or exposing an API, GoPort gives your localhost a public URL in seconds — without port forwarding, firewall changes, or a public IP.

Built for developers, GoPort makes it easy to expose services running on your machine while keeping setup simple and infrastructure under your control. It uses a persistent multiplexed connection to efficiently route traffic between the public internet and your local application.

Unlike many hosted tunneling services, GoPort can be fully self-hosted, allowing teams to manage their own tunnels, domains, and infrastructure without vendor lock-in.

How it works

  1. Authenticate the CLI

    goport auth <token>
    

    Authenticate the CLI with your GoPort account and connect it to your server.

  2. Start a tunnel

    goport http 8080
    

    GoPort opens a secure outbound connection and instantly creates a public HTTPS URL for your local application.

  3. Use a custom subdomain

    goport http 8080 --custom myapp
    

    Request a memorable URL for your tunnel:

    https://myapp.goport.uz
    
  4. Generate a new URL

    goport http 8080 --reset
    

    Discards the current subdomain and creates a brand-new public URL.

  5. Monitor traffic in real time

    After connecting, GoPort launches a local dashboard where you can inspect incoming requests, responses, tunnel status, and latency.

    GoPort Dashboard
  6. Route traffic to localhost

    When someone visits your public URL, GoPort forwards the request through a secure tunnel directly to your local application.

  7. Disconnect cleanly

    Press Ctrl+C at any time to close the tunnel. GoPort automatically removes the active session and releases the URL.

Installation

macOS

Install via Homebrew:

brew tap muhammad-deve/goport
brew install goport

Windows

Install via Chocolatey:

choco install goport

Linux

Install with the official installation script:

curl -fsSL https://github.com/muhammad-deve/GoPort/releases/latest/download/goport-linux-amd64 -o /usr/local/bin/goport && chmod +x /usr/local/bin/goport

Verify Installation

goport --version

You should see the installed GoPort version printed to the terminal.


Technical Details

Why TCP + yamux instead of a plain HTTP proxy?

GoPort uses a persistent TCP connection between the CLI and the server, with request multiplexing powered by yamux.

A plain HTTP proxy opens a new connection per request and struggles with protocols that require long-lived connections, such as WebSockets and streaming responses. By multiplexing multiple streams over a single TCP connection, GoPort handles concurrency efficiently while remaining reliable behind NAT and firewalls.

The CLI also detects HTTP upgrade requests and switches to raw bidirectional forwarding when necessary, allowing WebSocket-based applications to work seamlessly.

One additional benefit is that GoPort preserves the original public Host header when forwarding requests to your local application. This keeps tools such as Swagger UI, OpenAPI, and host-based routing frameworks working exactly as they would in production.

Tech Stack

  • Go — CLI and tunnel engine
  • Cobra — Command-line interface
  • yamux — TCP stream multiplexing
  • PocketBase — Authentication, tunnel management, and subdomain registry
  • Next.js — Website and dashboard

License

GoPort is released under the MIT License.

Documentation

Overview

Package goport opens public GoPort tunnels to local TCP ports.

Index

Constants

View Source
const (
	// DefaultServer is the public GoPort TCP tunnel endpoint.
	DefaultServer = "goport.uz:7000"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a small builder for opening GoPort tunnels.

func New

func New(token string, opts ...Option) *Client

New returns a tunnel client builder authenticated with token.

func (*Client) Open

func (c *Client) Open(port int) (Tunnel, error)

Open establishes a tunnel to localhost:port.

func (*Client) Reset

func (c *Client) Reset() *Client

Reset requests a fresh random subdomain for the tunnel.

func (*Client) Subdomain

func (c *Client) Subdomain(name string) *Client

Subdomain requests a custom public subdomain for the tunnel.

func (*Client) WithServer

func (c *Client) WithServer(addr string) *Client

WithServer overrides the default GoPort TCP tunnel server address.

type Option

type Option func(*Client)

Option configures a Client returned by New.

func WithServer

func WithServer(addr string) Option

WithServer overrides the default GoPort TCP tunnel server address.

type Tunnel

type Tunnel interface {
	URL() string
	Close() error
}

Tunnel is an active public tunnel to a local port.

Jump to

Keyboard shortcuts

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