moesocks: A functional firewall killer

[ apache, network, program ] [ Propose Tags ]

A SOCKS5 proxy using the client / server architecture.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Change log
Dependencies aeson, async, attoparsec, base (>4 && <=5), binary, bytestring, containers, cryptohash, hslogger, HsOpenSSL, iproute, lens, lens-aeson, mtl, network, optparse-applicative, random, stm, strict, text, time, transformers, unordered-containers [details]
License Apache-2.0
Copyright Copyright (C) 2015 Jinjing Wang
Author Jinjing Wang
Maintainer Jinjing Wang <>
Category Network
Home page
Source repo head: git clone git://
Uploaded by JinjingWang at 2018-12-27T18:12:16Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables moesocks
Downloads 30907 total (54 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2018-12-27 [all 2 reports]

Readme for moesocks-

[back to package description]


A SOCKS5 proxy using the client / server architecture.

MoeSocks is mostly compatible with shadowsocks.


From binary

Install Nix

curl | sh 

Install moesocks

nix-env -i -A nixpkgs.haskellPackages.moesocks



From source

Install GHC and cabal-install

Download moesocks

git clone


cd moesocks
cabal sandbox init


cabal install




  • Start a remote node outside a firewall:

      moesocks -r remote -k birthday!
  • Start a local node inside a firewall:

      moesocks -s $REMOTE_IP -k birthday!
  • Now you have a SOCKS5 proxy running inside a firewall on port 1080.

  • See more options:

      moesocks --help


  • SOCKS5 proxy service, tested with GFW.
  • TCP port forwarding.
  • UDP port forwarding, for example to tunnel DNS request: -U 5300:
  • SOCKS5 service on local can be turned off.
  • Understand shadowsocks' json configuration file.

Known issues

  • UDP over SOCKS5 is not implemented.
  • TCP bind over SOCKS5 is not implemented.
  • A bit slower then the Python implementation.
  • Only works on Unix.


TCP Fast Open (TFO)

Benefit of using TFO

TFO can bypass the TCP three-way handshake in successive connections, thus reducing latency.

Enable TFO in your OS runtime.

On Linux 3.7+, to check the availability of TFO:

cat /proc/sys/net/ipv4/tcp_fastopen

On Linux 3.7+, to enable TFO (as root):

echo 3 > /proc/sys/net/ipv4/tcp_fastopen

Enable TFO in MoeSocks

TFO can be turned on by adding a "fastOpen":true field in config.json or adding a --fast-open argument in the command line.


Use tcpdump on the remotePort, check for that SYN should start to carry payload. An example command is:

tcpdump port 8388 -i any -X -v


Using tcp-bbr as the congestion control algorithm should dramatically increase your bandwith in most cases.


  • shadowsocks greatly inspired MoeSocks.
  • shadowsocks-haskell another implementation of shadowsocks in Haskell, also greatly inspired MoeSocks. Much of the understanding of the internal of shadowsocks was gained by reading shadowsocks-haskell.


Copyright 2015 Jinjing Wang

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.