Git Product home page Git Product logo

outline-ss-server's Introduction

Outline ss-server

Build Status Mattermost Reddit

This repository has the Shadowsocks service used by Outline servers. It was inspired by go-shadowsocks2, and adds a number of improvements to meet the needs of the Outline users.

The Outline Shadowsocks service allows for:

  • Multiple users on a single port.
    • Does so by trying all the different credentials until one succeeds.
  • Multiple ports
  • Whitebox monitoring of the service using prometheus.io
    • Includes traffic measurements and other health indicators.
  • Live updates via config change + SIGHUP
  • Replay defense (add --replay_history 10000). See PROBES for details.

Graphana Dashboard

Try it!

Fetch dependencies for this demo:

GO111MODULE=off go get github.com/shadowsocks/go-shadowsocks2 github.com/prometheus/prometheus/cmd/...

If that doesn't work, download the prometheus or go-shadowsocks2 binaries directly.

Run the server

On Terminal 1, from the repository directory, build and start the SS server:

go run . -config config_example.yml -metrics localhost:9091 --replay_history=10000

In production, you may want to specify -ip_country_db to get per-country metrics. See how the Outline Server calls outline-ss-server.

Run the Prometheus scraper for metrics collection

On Terminal 2, start prometheus scraper for metrics collection:

$(go env GOPATH)/bin/prometheus --config.file=prometheus_example.yml

Run the SOCKS-to-Shadowsocks client

On Terminal 3, start the SS client:

$(go env GOPATH)/bin/go-shadowsocks2 -c ss://chacha20-ietf-poly1305:Secret0@:9000 -verbose  -socks localhost:1080

Fetch a page over Shadowsocks

On Terminal 4, fetch a page using the SS client:

curl --proxy socks5h://localhost:1080 example.com

Stop and restart the client on Terminal 3 with "Secret1" as the password and try to fetch the page again on Terminal 4.

Check the metrics

Open http://localhost:9091/metrics and see the exported Prometheus variables.

Open http://localhost:9090/ and see the Prometheus server dashboard.

Performance Testing

Start the iperf3 server (runs on port 5201 by default):

iperf3 -s

Start the SS server (listening on port 9000):

go run . -config config_example.yml

Start the SS tunnel to redirect port 8000 -> localhost:5201 via the proxy on 9000:

$(go env GOPATH)/bin/go-shadowsocks2 -c ss://chacha20-ietf-poly1305:Secret0@:9000 -tcptun ":8000=localhost:5201" -udptun ":8000=localhost:5201" -verbose

Test TCP upload (client -> server):

iperf3 -c localhost -p 8000

Test TCP download (server -> client):

iperf3 -c localhost -p 8000 --reverse

Test UDP upload:

iperf3 -c localhost -p 8000 --udp -b 0

Test UDP download:

iperf3 -c localhost -p 8000 --udp -b 0 --reverse

Compare to go-shadowsocks2

Run the commands above, but start the SS server with

$(go env GOPATH)/bin/go-shadowsocks2 -s ss://chacha20-ietf-poly1305:Secret0@:9000 -verbose

Compare to shadowsocks-libev

Start the SS server (listening on port 10001):

ss-server -s localhost -p 10001 -m chacha20-ietf-poly1305 -k Secret1 -u -v

Start the SS tunnel to redirect port 10002 -> localhost:5201 via the proxy on 10001:

ss-tunnel -s localhost -p 10001 -m chacha20-ietf-poly1305 -k Secret1 -l 10002 -L localhost:5201 -u -v

Run the iperf3 client tests listed above on port 10002.

You can mix and match the libev and go servers and clients.

Tests and Benchmarks

To run the tests and benchmarks, call:

make test

You can benchmark the cipher finding code with

go test -cpuprofile cpu.prof -memprofile mem.prof -bench . -benchmem -run=^$ github.com/Jigsaw-Code/outline-ss-server/shadowsocks

You can inspect the CPU or memory profiles with go tool pprof cpu.prof or go tool pprof mem.prof, and then enter web on the prompt.

Release

We use GoReleaser to build and upload binaries to our GitHub releases.

Summary:

Full instructions in GoReleaser's Quick Start (jump to the section starting "You’ll need to export a GITHUB_TOKEN environment variable").

outline-ss-server's People

Contributors

fortuna avatar tatianab avatar jsoref avatar trevj avatar alalamav avatar ducksoft avatar gennadyspb avatar siavashs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.