修订代码;将addr的赋值从各个proxy自己的方法中提出来

This commit is contained in:
hahahrfool
2022-03-23 18:54:38 +08:00
parent b2c6abe330
commit 8c6ed6377d
9 changed files with 46 additions and 25 deletions

View File

@@ -19,9 +19,9 @@ func init() {
proxy.RegisterServer(name, &ServerCreator{})
}
//只有地址和port需要配置非常简单
type ServerCreator struct{}
//只有地址和port需要配置非常简单
func (_ ServerCreator) NewServerFromURL(u *url.URL) (proxy.Server, error) {
addr := u.Host //若不给出port那就只有host名这样不好我们“默认”, 配置里肯定给了port
@@ -36,9 +36,7 @@ func (_ ServerCreator) NewServerFromURL(u *url.URL) (proxy.Server, error) {
func (_ ServerCreator) NewServer(dc *proxy.ListenConf) (proxy.Server, error) {
s := &Server{
ProxyCommonStruct: proxy.ProxyCommonStruct{Addr: dc.GetAddr()},
}
s := &Server{}
return s, nil
}