修订文档, fix #98, http和socks5在没配置多用户时会闪退

This commit is contained in:
e1732a364fed
2000-01-01 00:00:00 +00:00
parent 4b151d7d3b
commit d29ed0857f
4 changed files with 11 additions and 8 deletions

View File

@@ -297,7 +297,7 @@ func (b *Base) GetAdvServer() advLayer.Server {
return b.AdvS
}
//setNetwork, Xver, Tag,Sockopt,Header,AdvancedL, InitAdvLayer
//setNetwork, Xver, Tag,Sockopt, IsFullcone, Header,AdvancedL, InitAdvLayer
func (b *Base) ConfigCommon(cc *CommonConf) {
b.setNetwork(cc.Network)

View File

@@ -139,7 +139,7 @@ func configCommonURLQueryForServer(ser BaseInterface, u *url.URL) {
}
}
//SetAddrStr, setNetwork
//SetAddrStr, setNetwork, Isfullcone
func configCommonByURL(baseI BaseInterface, u *url.URL) {
if u.Scheme != DirectName {
baseI.SetAddrStr(u.Host) //若不给出port那就只有host名这样不好我们 默认 配置里肯定给了port

View File

@@ -51,7 +51,7 @@ type ServerCreator struct{}
func (ServerCreator) NewServerFromURL(u *url.URL) (proxy.Server, error) {
s := newServer()
s := NewServer()
var userPass utils.UserPass
if userPass.InitWithUrl(u) {
s.AddUser(&userPass)
@@ -60,7 +60,7 @@ func (ServerCreator) NewServerFromURL(u *url.URL) (proxy.Server, error) {
}
func (ServerCreator) NewServer(lc *proxy.ListenConf) (proxy.Server, error) {
s := newServer()
s := NewServer()
if str := lc.Uuid; str != "" {
var userPass utils.UserPass
if userPass.InitWithStr(str) {
@@ -89,7 +89,7 @@ type Server struct {
OnlyConnect bool //是否仅支持Connect命令; 如果为true, 则直接通过 GET http://xxx 这种请求不再被认为是有效的。之前本以为connect就可以搞定一切后来实测发现 wget 确实在 非https时 会用 纯http请求的方式 请求代理。所以 一般 OnlyConnect 为 false即可.
}
func newServer() *Server {
func NewServer() *Server {
s := &Server{
MultiUserMap: utils.NewMultiUserMap(),
}

View File

@@ -52,14 +52,17 @@ func (ServerCreator) NewServer(dc *proxy.ListenConf) (proxy.Server, error) {
}
func newServer() *Server {
return &Server{}
return &Server{
hs: http.NewServer(),
ss: socks5.NewServer(),
}
}
type Server struct {
proxy.Base
hs http.Server
ss socks5.Server
hs *http.Server
ss *socks5.Server
}
func (*Server) Name() string {