Coder Social home page Coder Social logo

orvice / shadowsocks-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shadowsocks/shadowsocks-go

240.0 25.0 111.0 6.61 MB

go port of shadowsocks

Home Page: http://shadowsocks.github.io/shadowsocks-go

License: Apache License 2.0

Makefile 0.49% Go 92.47% Shell 6.97% Batchfile 0.07%

shadowsocks-go's Introduction

shadowsocks-go

Join the chat at https://gitter.im/orvice/shadowsocks-go

Current version: 1.1.4 Build Status

shadowsocks-go is a lightweight tunnel proxy which can help you get through firewalls. It is a port of shadowsocks.

The protocol is compatible with the origin shadowsocks (if both have been upgraded to the latest version).

Note server_password option syntax changed in 0.6.2, the client now connects to servers in the order specified in the config.

Please develop on the latest develop branch if you want to send pull request.

Install

Compiled client binaries can be download here. (All compiled with cgo disabled, except the mac version.)

You can also install from source (assume you have go installed):

# on server
go get shadowsocks/shadowsocks-go/cmd/shadowsocks-server
# on client
go get shadowsocks/shadowsocks-go/cmd/shadowsocks-local

It's recommended to disable cgo when compiling shadowsocks-go. This will prevent the go runtime from creating too many threads for dns lookup.

Usage

Both the server and client program will look for config.json in the current directory. You can use -c option to specify another configuration file.

Configuration file is in json format and has the same syntax with shadowsocks-nodejs. You can download the sample config.json, change the following values:

server          your server ip or hostname
server_port     server port
local_port      local socks5 proxy port
method          encryption method, null by default (table), the following methods are supported:
                    aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4-md5, chacha20, salsa20, rc4, table
password        a password used to encrypt transfer
timeout         server option, in seconds

Run shadowsocks-server on your server. To run it in the background, run shadowsocks-server > log &.

On client, run shadowsocks-local. Change proxy settings of your browser to

SOCKS5 127.0.0.1:local_port

About encryption methods

AES is recommended for shadowsocks-go. Intel AES Instruction Set will be used if available and can make encryption/decryption very fast. To be more specific, aes-128-cfb is recommended as it is faster and secure enough.

rc4 and table encryption methods are deprecated because they are not secure.

Command line options

Command line options can override settings from configuration files. Use -h option to see all available options.

shadowsocks-local -s server_address -p server_port -k password
    -m aes-128-cfb -c config.json
    -b local_address -l local_port
shadowsocks-server -p server_port -k password
    -m aes-128-cfb -c config.json
    -t timeout

Use -d option to enable debug message.

Use multiple servers on client

server_password    specify multiple server and password, server should be in the form of host:port

Here's a sample configuration client-multi-server.json. Given server_password, client program will ignore server_port, server and password options.

Servers are chosen in the order specified in the config. If a server can't be connected (connection failure), the client will try the next one. (Client will retry failed server with some probability to discover server recovery.)

Multiple users with different passwords on server

The server can support users with different passwords. Each user will be served by a unique port. Use the following options on the server for such setup:

port_password   specify multiple ports and passwords to support multiple users

Here's a sample configuration server-multi-port.json. Given port_password, server program will ignore server_port and password options.

Update port password for a running server

Edit the config file used to start the server, then send SIGHUP to the server process.

Note to OpenVZ users

Use OpenVZ VM that supports vswap. Otherwise, the OS will incorrectly account much more memory than actually used. shadowsocks-go on OpenVZ VM with vswap takes about 3MB memory after startup. (Refer to this issue for more details.)

If vswap is not an option and memory usage is a problem for you, try shadowsocks-libev.

shadowsocks-go's People

Contributors

amyangfei avatar ayanamist avatar clowwindy avatar cyfdecyf avatar ddatsh avatar defia avatar defp avatar dujiulun avatar genzj avatar gitter-badger avatar hugozhu avatar jemyzhang avatar orvice avatar thomasf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shadowsocks-go's Issues

panic: runtime error: invalid memory address or nil pointer dereference

执行 ./mu 后,出现以下错误,go 版本为 1.6

root@linux:/root/go/src/github.com/orvice/shadowsocks-go/mu# ./mu
INFO[0000] PONG
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x401118]

goroutine 1 [running]:
panic(0x98cc40, 0xc82000a0d0)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
main.boot()
    /root/go/src/github.com/orvice/shadowsocks-go/mu/boot.go:31 +0x118
main.main()
    /root/go/src/github.com/orvice/shadowsocks-go/mu/main.go:31 +0x28f

panic: runtime error: invalid memory address or nil pointer dereference

似乎都设置正确,但是不知道问题出在哪..

# go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go/go/gopath"
GORACE=""
GOROOT="/root/go/go"
GOTOOLDIR="/root/go/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

go version go1.6.2 linux/amd64

# ./mu -debug
INFO[0000] PONG
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x401118]

goroutine 1 [running]:
panic(0x992fc0, 0xc82000a100)
        /root/go/go/src/runtime/panic.go:481 +0x3e6
main.boot()
        /root/go/go/gopath/src/github.com/orvice/shadowsocks-go/mu/boot.go:31 +0x118
main.main()
        /root/go/go/gopath/src/github.com/orvice/shadowsocks-go/mu/main.go:31 +0x28f

求帮忙看下

mysql不统计流量

client=mysql,好像不统计流量呢。一直不变,问一下这是bug,还是不支持。

Vultr VPS Ubuntu 14.04 64 bit执行go get报错

go version:go1.6 linux/amd64

进入mu目录后执行go get,会提示以下错误:

github.com/orvice/shadowsocks-go/mu/mysql

mysql/mysql_boot.go:24: cannot use &db (type **gorm.DB) as type *gorm.DB in argument to c.SetDb

master分支和dev分支都会报错。

昨天在IDCF的VPS上,同样的系统和Go版本,go get的时候没有问题。

go get编译的时候出现错误

go build github.com/jinzhu/gorm: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed
go build github.com/lib/pq: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed
go build gopkg.in/redis.v3: /usr/local/go/pkg/tool/linux_amd64/compile: signal: killed
请问这是怎么回事

webapi方式出现错误“ERR wrong number of arguments for 'set' command”

INFO[0064] [port-10020]connecting 74.125.25.188:5228
DEBU[0064] 10020 conn debug: local addr: 192.157.226.60:10020 | remote addr: 114.250.57.42:34494 network: tcp
ERRO[0064] ERR wrong number of arguments for 'set' command
ERRO[0064] [port-10020] Error: request 74.125.25.188:5228 cancel
DEBU[0065] new client 114.250.57.42:47170->192.157.226.60:10020

想问一个新手问题 关于安装问题

请问怎样安装mu目录?
已安装go语言go1.6.linux-amd64
怎样进行go get mu目录?
我是这样的
go get github.com/shadowsocks/shadowsocks-go/mu
不知道对不对?
如果是对的话那为什么出现:
package github.com/shadowsocks/shadowsocks-go/mu: cannot find package "github.com/shadowsocks/shadowsocks-go/mu" in any of:
/root/go/src/github.com/shadowsocks/shadowsocks-go/mu (from $GOROOT)
/root/gocode/src/github.com/shadowsocks/shadowsocks-go/mu (from $GOPATH)
爬了​​很多文 也找不到怎样安装
希望能够解答一下我这个新手问题 谢谢你了

go版本ss连接正常,但是会有以下Error,是不是不支持UDP?

9.59.148.73:443 cancel"
time="2016-03-31T10:16:20+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:17:40+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:17:58+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:17:58+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:01+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:03+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:03+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:06+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:20+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:20+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:22+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:23+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:25+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:28+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:18:30+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:19:11+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:12+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:12+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:17+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:22+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:25+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:25+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:30+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:22:35+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:26:42+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:26:43+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:26:43+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:27:05+08:00" level=error msg="[port-10020] Error: request 8.8.8.8:53 cancel"
time="2016-03-31T10:27:06+08:00" level=error msg="[port-10020] Error: request 216.58.216.42:443 cancel"

无法浏览网页,DNS查询失败?

错误信息如下:
INFO[0020] [port-23768]connecting 192.168.0.1:1900
ERRO[0027] error connecting to:192.168.0.1:1900dial tcp 192.168.0.1:1900: getsockopt: connection timed out
浏览器返回超时或者DNS查找失败错误
请问应该怎么解决这个问题呢?谢谢

运行mu报错

DEBU[0000] debug on
INFO[0000] PONG
INFO[0000] 0
INFO[0000] 0
INFO[0000] 0
INFO[0000] sync finish...
INFO[0000] 0
DEBU[0000] []
INFO[0000] check finish...
请问这是怎么回事

mu 后能正常启动,并看提示显示是正在监听端口,但是客户端启用后不能连接

mu 后能正常启动,并看提示显示是正在监听端口,但是客户端启用后不能连接

[root@60bb mu]# mu
INFO[0000] PONG
INFO[0000] 1
INFO[0000] 1
INFO[0000] 1
INFO[0000] new user to run{1 8389 05pf rc-md5 1 5467275264 0 0}
INFO[0000] check finish...
INFO[0000] server listening port 8389 ...

INFO[0000] 1
INFO[0000] sync finish...start logging online count
INFO[0060] 1
INFO[0060] sync finish...start logging online count
INFO[0060] 1
INFO[0060] check finish...

我另外搭建的有单用户的 ss 则可以正常连接

webapi连接ssl的问题及mysql的问题, 求大大出手

用webapi连接, 但是我的网站地址是启用了ssl的, 并且配置http强制跳转https, 但是我的是个人未认证证书, 运行mu出现如下错误:
ERRO[0000] Get User ErrorGet https://45.32.**.**/users?key=***FFFGYYdrrt89: x509: certificate signed by unknown authority

另外尝试配置mysql, 配置如下:

[mysql]
host 45.32..:3306
user ss
pass ******
db shadowsocks
table table

table这里不知道怎么填, 是填user这个表么?

然后运行出现以下错误, go版本为1.6:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x401118]

goroutine 1 [running]:
panic(0x982c20, 0xc82000e0f0)
/usr/local/go/src/runtime/panic.go:464 +0x3e6
main.boot()
/root/workstation/go/src/github.com/orvice/shadowsocks-go/mu/boot.go:31 +0x118
main.main()
/root/workstation/go/src/github.com/orvice/shadowsocks-go/mu/main.go:31 +0x28f

go mu版无法正常启动

root@50KVM-2016316749:~/.go/bin# ./mu -debug
DEBU[0000] debug on
INFO[0000] PONG
ERRO[0000] Get User Errorinvalid character '<' looking for beginning of value

Cannot get the source code of redis.v3

This is what I get.

root@vultr:~/shadowsocks-go/mu# go get  
Segmentation fault

So I tried and found only redis.v3 cannot be fetched.

root@vultr:~/shadowsocks-go/mu# go get gopkg.in/redis.v3  
Segmentation fault

关于 shawdowsocks-go 和 mu 的问题

[root@60bcb29b98fb mu]# mu
INFO[0000] PONG
INFO[0000] 1
INFO[0000] 1
INFO[0000] 1
INFO[0000] new user to run{1 8389 ZD05pf rc4-md5 1 5467275264 0 0}
INFO[0000] check finish...
INFO[0000] server listening port 8389 ...

INFO[0000] 1
INFO[0000] sync finish...start logging online count

mu 已经跑起来了 ,但是客户端配置后仍然无法联网,是否需要单独跑 shadowsocks-server ?

接着,我又重新 go get 了一下 shadowsocks-server ,并且,shadowsocks-server 正常执行

[root@60bcb29b98fb bin]# ./shadowsocks-server
2016/04/13 09:40:55 server listening port 8388 ...
2016/04/13 09:41:02 creating cipher for port: 8388
2016/04/13 09:41:02 error getting request 60.208.166.115:61586 192.168.0.9:8388 addr type 117 not supported

``

这时候,如果我在客户端直接使用 shadowsocks-server 中 config.json 密码和 method 则可以正常连网,但是如果我使用 mu 中生成的密码和 method 则无法联网,请问这个要怎么解决?

level=error msg="Update Online Count Failed"

请问这是什么问题?我的shadowsocks-go跑起来了,ss-panel也运行正常,但是上不了网。

我的config.conf配置是这样的,请问对吗?

[root@localhost mu]# cat ~/.go/bin/config.conf

[base]
N 1
ip 0.0.0.0
client webapi
checktime 60
synctime 60

[webapi]
url http://ip/mu
key xxxxyyyyyzzzz -----和ss-panel 中 .env文件的muKey一样
node_id 1

[mysql]
host 127.0.0.1:3306
user root
pass passwdxxx
db sspanel
table user

[redis]
host localhost:6379

[root@localhost bin]# supervisorctl tail -f shadowsocks stderr
==> Press Ctrl-C to exit <==
time="2016-06-13T08:48:29-04:00" level=info msg=PONG
time="2016-06-13T08:48:30-04:00" level=info msg=0
time="2016-06-13T08:48:30-04:00" level=info msg=0
time="2016-06-13T08:48:30-04:00" level=info msg=0
time="2016-06-13T08:48:30-04:00" level=info msg="check finish..."
time="2016-06-13T08:48:30-04:00" level=info msg=0
time="2016-06-13T08:48:30-04:00" level=info msg="sync finish...start logging online count"
time="2016-06-13T08:48:30-04:00" level=error msg="Update Online Count Failed"
time="2016-06-13T08:48:30-04:00" level=error msg="Update Online Count Failed"
time="2016-06-13T08:49:30-04:00" level=info msg=0
time="2016-06-13T08:49:30-04:00" level=info msg="check finish..."
time="2016-06-13T08:49:30-04:00" level=info msg=0
time="2016-06-13T08:49:30-04:00" level=info msg="sync finish...start logging online count"
time="2016-06-13T08:49:30-04:00" level=error msg="Update Online Count Failed"
time="2016-06-13T08:49:30-04:00" level=error msg="Update Online Count Failed"
^C
[root@localhost bin]#

请问如何定义timeout?

mu版本怎么定义TIMEOUT时间呢?config里面特别简单。但是找不到哪里有写TIMEOUT。谢谢

在 mu 目录下执行 go build 时失败

如题,执行 go build 时提示

#go build

log.go:4:2: cannot find package "github.com/Sirupsen/logrus" in any of:
        /usr/lib/golang/src/github.com/Sirupsen/logrus (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/Sirupsen/logrus (from $GOPATH)
config.go:4:2: cannot find package "github.com/Terry-Mao/goconf" in any of:
        /usr/lib/golang/src/github.com/Terry-Mao/goconf (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/Terry-Mao/goconf (from $GOPATH)
func.go:13:2: cannot find package "github.com/cyfdecyf/leakybuf" in any of:
        /usr/lib/golang/src/github.com/cyfdecyf/leakybuf (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/cyfdecyf/leakybuf (from $GOPATH)
boot.go:5:2: cannot find package "github.com/orvice/shadowsocks-go/mu/config" in any of:
        /usr/lib/golang/src/github.com/orvice/shadowsocks-go/mu/config (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/orvice/shadowsocks-go/mu/config (from $GOPATH)
log.go:5:2: cannot find package "github.com/orvice/shadowsocks-go/mu/log" in any of:
        /usr/lib/golang/src/github.com/orvice/shadowsocks-go/mu/log (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/orvice/shadowsocks-go/mu/log (from $GOPATH)
client.go:5:2: cannot find package "github.com/orvice/shadowsocks-go/mu/mysql" in any of:
        /usr/lib/golang/src/github.com/orvice/shadowsocks-go/mu/mysql (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/orvice/shadowsocks-go/mu/mysql (from $GOPATH)
boot.go:6:2: cannot find package "github.com/orvice/shadowsocks-go/mu/user" in any of:
        /usr/lib/golang/src/github.com/orvice/shadowsocks-go/mu/user (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/orvice/shadowsocks-go/mu/user (from $GOPATH)
client.go:7:2: cannot find package "github.com/orvice/shadowsocks-go/mu/webapi" in any of:
        /usr/lib/golang/src/github.com/orvice/shadowsocks-go/mu/webapi (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/orvice/shadowsocks-go/mu/webapi (from $GOPATH)
boot.go:7:2: cannot find package "github.com/shadowsocks/shadowsocks-go/shadowsocks" in any of:
        /usr/lib/golang/src/github.com/shadowsocks/shadowsocks-go/shadowsocks (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/github.com/shadowsocks/shadowsocks-go/shadowsocks (from $GOPATH)
redis.go:7:2: cannot find package "gopkg.in/redis.v3" in any of:
        /usr/lib/golang/src/gopkg.in/redis.v3 (from $GOROOT)
        /var/shadowsocks/shadowsocks-go/src/gopkg.in/redis.v3 (from $GOPATH)

怎样解决启动./mu错误?

安装ss go mu后 ./mu启动出现错误
ERRO[0000] error listening port 1333: listen tcp :1333: bind: address already in use
请问怎样解决?

出现ERR wrong number of arguments for 'set' command的错误信息

在正常使用大概一周的时间以后突然出现了这样的出错信息
INFO[0010] [port-30000]connecting global.bing.com:80 ERRO[0010] ERR wrong number of arguments for 'set' command INFO[0060] 18 INFO[0060] 18 INFO[0060] check finish... INFO[0060] sync finish...start logging online count
重启vps和radis服务端都无法解决...请问是什么问题

启动报错

提示:

INFO[0121] sync finish...start logging online count
ERRO[0121] invalid character '<' looking for beginning of value

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.