go-websockproxy

command module
v0.0.0-...-f5190b5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2016 License: GPL-2.0 Imports: 15 Imported by: 0

README

go-websockproxy

This is a Go port of websockproxy licensed under GNU/GPLv2. It is a websockets server that allows network support in jor1k OR1K emulators running Linux.

Pull requests are welcome.

Features

  • client authentication
  • secure websockets (TLS a.k.a. wss://)
  • MAC prefix whitelisting
  • download/upload rate limiting
  • serving a directory with static files
  • re-attaching persistent TAP interfaces (would be handy for non-root usage)
Usage of bin/go-websockproxy:
  --auth-key string
    	accept TAP traffic via websockets only if authorized with this key; by default is disabled (accepts any traffic)
  --cert-file string
    	certificate for listening on TLS connections; by default TLS is disabled
  --key-file string
    	key file for listening on TLS connections; by default TLS is disabled
  --listen-address string
    	address to listen on for incoming websocket connections; URI is '/wstap' (default ":8000")
  --log-level string
    	one of 'debug', 'info', 'warning', 'error' (default "warning")
  --mac-prefix string
    	accept websockets traffic only with MACs starting with the specified prefix (default is disabled)
  --max-download-bandwidth string
    	max upload bandwidth per client; leave empty for unlimited
  --max-upload-bandwidth string
    	max upload bandwidth per client; leave empty for unlimited
  --static-directory string
    	static files directory to serve at '/'; disabled by default
  --tap-ipv4 string
    	IPv4 address for the TAP interface; used only when interface is created (default "10.3.0.1/16")

go-websockproxy would by default be accessible at wss://localhost:8000/wstap.

In order to use features like AUTH key, query-specified relay URL and MAC address whitelisting, give a peek to author's fork of jor1k.

Building

Repository's submodules should be initialised:

git submodule update --init --recursive

Build with:

make

Then you can run:

bin/go-websockproxy

Example usage (as root)

A simple command-line:

bin/go-websockproxy --listen-address=:8080 --tap-ipv4=10.5.0.1/16 --static-directory=jor1k --max-download-bandwidth=50kbps --max-upload-bandwidth=50kbps --log-level=info

A more complex command-line:

bin/go-websockproxy --cert-file=mycert.pem --key-file=mycert.key --mac-prefix="00:15 --auth-key="yoursecrethere"  --max-download-bandwidth=50kbps --max-upload-bandwidth=50kbps --log-level=debug"

Once go-websockproxy is started, you may want to start a DHCP server as in:

dnsmasq -d --bind-interfaces --listen-address=10.3.0.1 --dhcp-range=10.3.0.50,10.3.0.200,12h --dhcp-option=option:router,10.3.0.1 --dhcp-option=option:dns-server,10.3.0.1 --log-dhcp

Additionally, IPv4 forwarding should be enabled if you want to allow the jor1k clients to connect to regular internet.

To quickly generate a TLS certificate + key pair: https://golang.org/src/crypto/tls/generate_cert.go

License

GNU/GPLv2

Thanks

Thanks to Benjamin Burns for the python version upon which I based this one and to Sebastian Macke for the great jor1k.

Documentation

Overview

go-websockproxy - https://github.com/gdm85/go-websockproxy

Copyright (C) 2016 gdm85

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

go-websockproxy - https://github.com/gdm85/go-websockproxy

Copyright (C) 2016 gdm85

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

go-websockproxy - https://github.com/gdm85/go-websockproxy

Copyright (C) 2016 gdm85

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Jump to

Keyboard shortcuts

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