shadysocks

package module
v0.0.0-...-9d0ef27 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

shadysocks

Build Status

+------+  SOCKS5   +-------+  shadowsocks   +-------+  TCP/UDP   +-----+
| user | --------> | rnode | -------------> | pnode | ---------> | dst |
+------+           +-------+       W        +-------+            +-----+

安装

  1. 确认$GOPATH有效
  2. go get -v github.com/en/shadysocks/cmd/{pnode,rnode}
  3. 测试(可选)
  • 安装dante-client 1.2.x+和nmap-ncat后,拷贝shadysocks/tests/socksify/socks.conf到/etc下
  • 进入$GOPATH/src/github.com/en/shadysocks下运行./tests/test.sh测试
  1. rnode运行在本地,pnode运行在远程服务器,并确认两者运行目录下有config.toml
  2. 修改rnode的config.toml, pnode = "远程服务器地址:8388"
  3. 修改pnode的config.toml, pnode = "0.0.0.0:8388", 监听本地8388端口
  4. chrome安装扩展SwitchyOmega, proxy server设置为rnode监听地址,默认为127.0.0.1:1081,协议为SOCKS5

特性

  • 支持SOCKS5 CONNECT
  • 支持SOCKS5 UDP ASSOCIATE
  • 支持OTA
  • 兼容原版ss

Documentation

Overview

http://www.ietf.org/rfc/rfc1928.txt

Index

Constants

View Source
const (
	OTADisabled = 1 << iota
	OTASenderRequest
	OTASenderChunk
	OTAReceiverRequest
	OTAReceiverChunk
)

Variables

This section is empty.

Functions

func HandleShadowsocksTCP

func HandleShadowsocksTCP(sc *shadowsocksConn) error

TODO: ugly

func HandleSocks5TCP

func HandleSocks5TCP(conn io.ReadWriteCloser, srv Node) error

func HandleSocks5UDP

func HandleSocks5UDP(conn net.PacketConn, saddr net.Addr, packet []byte, srv Node) error

func ParseConfig

func ParseConfig(path string, conf *Config) error

Types

type Config

type Config struct {
	Rnode       string `toml:"rnode"`
	Pnode       string `toml:"pnode"`
	Password    string `toml:"password"`
	Timeout     int    `toml:"timeout"`
	Method      string `toml:"method"`
	FastOpen    bool   `toml:"fast_open"`
	Workers     int    `toml:"workers"`
	PreferIpv6  bool   `toml:"prefer_ipv6"`
	OneTimeAuth bool   `toml:"one_time_auth"`
}

type Node

type Node interface {
	LocalTCPAddr() *net.TCPAddr
	LocalUDPAddr() *net.UDPAddr

	RemoteTCPAddr() *net.TCPAddr
	RemoteUDPAddr() *net.UDPAddr

	DialTCP() (net.Conn, error)
	DialUDP() (net.PacketConn, error)
}

type Shadowsocks

type Shadowsocks struct {
	RemoteTCPAddr *net.TCPAddr
	RemoteUDPAddr *net.UDPAddr
	// contains filtered or unexported fields
}

func NewShadowsocks

func NewShadowsocks(raddr, method, password string, otaStatus int) (*Shadowsocks, error)

func (*Shadowsocks) AcceptTCP

func (ss *Shadowsocks) AcceptTCP(conn net.Conn) (*shadowsocksConn, error)

func (*Shadowsocks) AcceptUDP

func (ss *Shadowsocks) AcceptUDP(conn *net.UDPConn) (*shadowsocksPacketConn, error)

func (*Shadowsocks) DialTCP

func (ss *Shadowsocks) DialTCP() (*shadowsocksConn, error)

func (*Shadowsocks) DialUDP

func (ss *Shadowsocks) DialUDP() (*shadowsocksPacketConn, error)

Directories

Path Synopsis
cmd
pnode command
rnode command

Jump to

Keyboard shortcuts

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