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
这里vs参考了gost的实现。gost中,Connector就相当于 client,Handler就相当于 Server
但是发现,没法一个server同时处理tcp和udp? 也就是说,只能预先指定服务端要处理的协议;
看ss的标准,也没有提及哪一项 可以指定 tcp/udp
重新阅读上面Protocol页面,参考阅读 http://overtalk.site/2020/02/25/network-shadowsocks/
ss不像vmess等协议一样,只使用一种传输层协议来传输 tcp和udp数据;而是:用tcp传tcp,用udp传udp。 如此的话,特征必很明显。
还有一个重要的问题,就是,我们vs的架构,在设计之初,就是为vmess/vless/trojan等 只需要一种传输层协议 来获取 多种传输层协议的客户端等数据的;
而为了支持ss,以目前的vs架构来说,要同时写两个listen,一个监听tcp,一个监听udp,如此才能做到。
而且对于client来说也比较棘手,因为我们的架构只认为需要dial单一的传输层协议就可以与一个服务端完整通信,所以配置文件里需要配置network指明使用的是哪个传输层协议;而如果是ss的模式的话,则客户端对tcp和udp都要拨号,也十分麻烦。
另外,本包是普通的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 ¶
const ( ATypIP4 = 0x1 ATypDomain = 0x3 ATypIP6 = 0x4 )
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 MethodPass ¶
type MethodPass struct {
Method, Password string
}
func (*MethodPass) InitWithStr ¶
func (ph *MethodPass) InitWithStr(str string) (ok bool)
uuid: "method:xxxx\npass:xxxx"
func (*MethodPass) InitWithUrl ¶
func (ph *MethodPass) InitWithUrl(u *url.URL) bool
require "method" and "pass" field. return true if both not empty.
type Server ¶
type Server struct { proxy.Base *utils.MultiUserMap // contains filtered or unexported fields }
func (*Server) MultiTransportLayer ¶
type ServerCreator ¶
type ServerCreator struct{}
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)