shadowsocks

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package shadowsocks implements shadowsocks protocol.

Reference

https://github.com/shadowsocks/shadowsocks-org/wiki/Protocol

https://github.com/shadowsocks/shadowsocks-org/wiki/AEAD-Ciphers

参考阅读 http://overtalk.site/2020/02/25/network-shadowsocks/

注意, shadowsocks 可能同时使用tcp和udp,但是一定会使用到 tcp, shadowsocks 的network只能设置为tcp或者dual

如dual话,特征必很明显。

另外,本包是普通的ss AEAD Ciphers ,不过它还是有问题。所以以后要研究ss-2022

https://github.com/shadowsocks/shadowsocks-org/issues/183

关于ss-2022 https://github.com/shadowsocks/shadowsocks-org/issues/196

Index

Constants

View Source
const (
	ATypIP4    = 0x1
	ATypDomain = 0x3
	ATypIP6    = 0x4
)
View Source
const Name = "shadowsocks"

Variables

This section is empty.

Functions

func GetAddrFrom

func GetAddrFrom(buf utils.ByteReader) (addr netLayer.Addr, err error)

依照shadowsocks协议的格式读取 地址的域名、ip、port信息 (same as socks5 and trojan)

Types

type Client

type Client struct {
	proxy.Base
	utils.UserPass
	// contains filtered or unexported fields
}

func (*Client) EstablishUDPChannel

func (c *Client) EstablishUDPChannel(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (mc netLayer.MsgConn, err error)

func (*Client) GetCreator

func (*Client) GetCreator() proxy.ClientCreator

func (*Client) Handshake

func (c *Client) Handshake(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (conn io.ReadWriteCloser, err error)

func (*Client) Name

func (*Client) Name() string

func (*Client) Network

func (c *Client) Network() string

type ClientCreator

type ClientCreator struct{ proxy.CreatorCommonStruct }

func (ClientCreator) MultiTransportLayer

func (ClientCreator) MultiTransportLayer() bool

func (ClientCreator) NewClient

func (ClientCreator) NewClient(dc *proxy.DialConf) (proxy.Client, error)

func (ClientCreator) URLToDialConf

func (ClientCreator) URLToDialConf(u *url.URL, dc *proxy.DialConf, format int) (*proxy.DialConf, error)

type MethodPass

type MethodPass struct {
	Method, Password string
}

实现 utils.User

func (MethodPass) AuthBytes added in v1.2.5

func (ph MethodPass) AuthBytes() []byte

func (MethodPass) AuthStr added in v1.2.5

func (ph MethodPass) AuthStr() string

func (MethodPass) IdentityBytes added in v1.2.5

func (ph MethodPass) IdentityBytes() []byte

func (MethodPass) IdentityStr added in v1.2.5

func (ph MethodPass) IdentityStr() string

func (*MethodPass) InitWithStr

func (ph *MethodPass) InitWithStr(str string) (ok bool)

uuid: "method:xxxx\npass:xxxx"

type Server

type Server struct {
	proxy.Base

	*utils.MultiUserMap
	// contains filtered or unexported fields
}

目前的实现只支持单用户

func (*Server) Handshake

func (s *Server) Handshake(underlay net.Conn) (result net.Conn, _ netLayer.MsgConn, targetAddr netLayer.Addr, returnErr error)

func (*Server) Name

func (*Server) Name() string

func (*Server) Network

func (s *Server) Network() string

func (*Server) SelfListen

func (s *Server) SelfListen() (is bool, _, udp int)

func (*Server) StartListen

func (s *Server) StartListen(_ func(netLayer.TCPRequestInfo), udpFunc func(netLayer.UDPRequestInfo)) io.Closer

非阻塞

type ServerCreator

type ServerCreator struct{ proxy.CreatorCommonStruct }

func (ServerCreator) AfterCommonConfServer

func (ServerCreator) AfterCommonConfServer(ps proxy.Server) (err error)

func (ServerCreator) MultiTransportLayer

func (ServerCreator) MultiTransportLayer() bool

func (ServerCreator) NewServer

func (ServerCreator) NewServer(lc *proxy.ListenConf) (proxy.Server, error)

func (ServerCreator) URLToListenConf

func (ServerCreator) URLToListenConf(u *url.URL, lc *proxy.ListenConf, format int) (*proxy.ListenConf, error)

Jump to

Keyboard shortcuts

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