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
- func GetAddrFrom(buf utils.ByteReader) (addr netLayer.Addr, err error)
- type Client
- func (c *Client) EstablishUDPChannel(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (mc netLayer.MsgConn, err error)
- func (*Client) GetCreator() proxy.ClientCreator
- func (c *Client) Handshake(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (conn io.ReadWriteCloser, err error)
- func (*Client) Name() string
- func (c *Client) Network() string
- type ClientCreator
- type MethodPass
- type Server
- func (s *Server) Handshake(underlay net.Conn) (result net.Conn, _ netLayer.MsgConn, targetAddr netLayer.Addr, returnErr error)
- func (*Server) Name() string
- func (s *Server) Network() string
- func (s *Server) SelfListen() (is bool, _, udp int)
- func (s *Server) StartListen(_ func(netLayer.TCPRequestInfo), udpFunc func(netLayer.UDPRequestInfo)) io.Closer
- type ServerCreator
- func (ServerCreator) AfterCommonConfServer(ps proxy.Server) (err error)
- func (ServerCreator) MultiTransportLayer() bool
- func (ServerCreator) NewServer(lc *proxy.ListenConf) (proxy.Server, error)
- func (ServerCreator) URLToListenConf(u *url.URL, lc *proxy.ListenConf, format int) (*proxy.ListenConf, error)
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 ¶
func (*Client) EstablishUDPChannel ¶
func (*Client) GetCreator ¶
func (*Client) GetCreator() proxy.ClientCreator
type ClientCreator ¶
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) MultiTransportLayer ¶
func (ClientCreator) MultiTransportLayer() bool
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) SelfListen ¶
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)
Click to show internal directories.
Click to hide internal directories.