serveo

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 9 Imported by: 0

README

Serveo

GoDoc Build Status

What is Serveo?

This is an open source (unofficial) CLI for serveo.net, a service that allows you to expose local servers without port forwarding.

Installation

Right now the only way to install serveo is from source.

You need to install go first, I recommend version 1.12 or higher. You also need openssh installed:

Debian/Ubuntu Linux

Open a terminal and run:

sudo apt-get install openssh-client
go get -v -u github.com/Axelen123/serveo/cmd/serveo
MacOS

Open a terminal and run:

go get -v -u github.com/Axelen123/serveo/cmd/serveo
Windows 10

Open the start menu and search for "features". Click on "Apps and features" -> "Manage optional features". Scroll down until you find "OpenSSH Client" (Not the server!) and click install.

Open a command prompt and run:

go get -v -u github.com/Axelen123/serveo/cmd/serveo

Now the binary should be in your GOPATH/bin folder. Make sure to add GOPATH/bin to your PATH.

Usage

HTTP

Exposing an http server is easy:

serveo http

#On another port:

# Replace 8080 with the port your server uses
serveo http -p 8080 

# You can also specify a custom [sub]domain:
# (if you don't specify a domain, your username will be used)

# These do the same thing
serveo http -d hello
serveo http -d hello.serveo.net

# For info on using a custom domain, see the wiki.
serveo http -d mydomain.com
SSH

You can expose SSH as well!

serveo ssh

# ssh also works with domains

serveo ssh -d hello

Use these commands to ssh into it:

# For OpenSSH 7.3 or newer:
ssh -J serveo.net username@mydomainoralias

# For OpenSSH 7.2 or older:
ssh -o ProxyCommand="ssh -W mydomainoralias:22 serveo.net" username@mydomainoralias
Config

The cli also supports config files, to initialize one you need to run:

serveo init

It should give you a file that looks like this:

{
  "http": 80,
  "ssh": false,
  "domain": "",
  "tcp": []
}

The configuration options are similar to the CLI options:

  • http: contains the port that an http server uses. You can disable it by setting to -1.
  • ssh: expose ssh server or not
  • domain: domain/alias for http and ssh
  • tcp: contains paths to expose, example (remove comments if you want to use these):
{
    "http": -1,
    "ssh": false,
    "domain": "",
    "tcp": [
        {
            "local": {
                // Expose http server on
                // raspberry pi
                "host": "raspberrypi",
                "port": 80
            },
            "remote": {
                "host": "pisrv",
                "port": 80
            }
        },
        {
            "local": {
                // expose local redis
                "host": "",
                "port": 6379
            },
            "remote": {
                "host": "redis",
                "port": 6379
            }
        }
    ]
}
Using the config

You can use the config like this:

# If you run without arguments it will
# use "serveo.config.json" as config file
serveo

# You can also specify config file:
serveo -c myconf.json

Docs

You can find reference documentation at godoc.

Contributing

Note: by contributing code to the Redis project in any form, including sending a pull request via Github, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms of the MIT license that you can find in the LICENSE file included in the source distribution.

See CONTRIBUTING.md for more info.

License

MIT

This project is not affiliated with serveo.net or its creator(s)

Documentation

Index

Constants

View Source
const ConfigName = "serveo.config.json"

ConfigName contains the name of the config file

Variables

This section is empty.

Functions

func Start

func Start(config *Config)

Start connects to serveo.net and starts forwarding with specified config

Types

type Args

type Args struct {
	Commands Commands
	Flags    Flags
}

Args holds parsed command line arguments

type Commands

type Commands struct {
	Init bool
	SSH  bool
	HTTP bool
}

Commands holds parsed commands

type Config

type Config struct {
	HTTP   int    `json:"http"`
	SSH    bool   `json:"ssh"`
	Domain string `json:"domain"`
	TCP    []TCP  `json:"tcp"`
}

Config holds the config

func GetConfig

func GetConfig(filename string) (*Config, error)

GetConfig reads and marshals the config file

type Endpoint

type Endpoint struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

Endpoint holds endpoint information

func (Endpoint) String

func (e Endpoint) String() string

type Flags

type Flags struct {
	Config string
	Domain string
	Port   int
}

Flags holds parsed flags

type TCP

type TCP struct {
	Local  Endpoint `json:"local"`
	Remote Endpoint `json:"remote"`
}

TCP holds JSON data for forwarded ports

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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