移除 ClientCreator.UseUDPAsMsgConn 方法

This commit is contained in:
e1732a364fed
2000-01-01 00:00:00 +00:00
parent c8ce5046db
commit 12f7dd1bc6
10 changed files with 3 additions and 37 deletions

View File

@@ -1200,12 +1200,12 @@ func dialClient(iics incomingInserverConnState, targetAddr netLayer.Addr,
realTargetAddr.Network = targetAddr.Network
}
dialhere := !(realTargetAddr.Network == "udp" && client.GetCreator().UseUDPAsMsgConn())
dialhere := !(client.Name() == proxy.DirectName)
/*
direct和shadowsocks的udp是自己拨号的因为它用到了udp的包特性
direct的udp是自己拨号的因为它用到了udp的fullcone
不是上面情况的话,也要分情况:
不是的话,也要分情况:
如果是单路的, 则我们在此dial, 如果是多路复用, 则不行, 因为要复用同一个连接
Instead, 我们要试图 取出已经拨号好了的 连接
*/
@@ -1251,8 +1251,6 @@ func dialClient(iics incomingInserverConnState, targetAddr netLayer.Addr,
na = client.LocalTCPAddr()
case "udp":
na = client.LocalUDPAddr()
case netLayer.DualNetworkName:
realTargetAddr.Network = targetAddr.Network
}
clientConn, err = realTargetAddr.Dial(client.GetSockopt(), na)

View File

@@ -61,8 +61,6 @@ type ClientCreator interface {
URLToDialConf(url *url.URL, iv *DialConf, format int) (*DialConf, error)
//DialConfToURL(url *DialConf, format int) (*url.URL, error)
UseUDPAsMsgConn() bool //默认情况下UDP会被包装成流式协议除非指出需要利用udp的固定包长度特性; direct 和 shadowsocks会返回true.
}
// 可通过标准配置或url 来初始化。

View File

@@ -18,10 +18,6 @@ const (
// implements ClientCreator for direct
type DirectCreator struct{ CreatorCommonStruct }
func (DirectCreator) UseUDPAsMsgConn() bool {
return true
}
// true
func (DirectCreator) MultiTransportLayer() bool {
return true

View File

@@ -58,9 +58,6 @@ func tryRejectWithHttpRespAndClose(rejectType string, underlay net.Conn) {
// implements ClientCreator and ServerCreator for reject
type RejectCreator struct{ CreatorCommonStruct }
func (RejectCreator) UseUDPAsMsgConn() bool {
return false
}
func (RejectCreator) NewClient(dc *DialConf) (Client, error) {
r := &RejectClient{}

View File

@@ -17,9 +17,6 @@ func init() {
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) UseUDPAsMsgConn() bool {
return false
}
func (ClientCreator) MultiTransportLayer() bool {
return true
}

View File

@@ -18,10 +18,6 @@ func init() {
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) UseUDPAsMsgConn() bool {
return false
}
func (ClientCreator) URLToDialConf(u *url.URL, dc *proxy.DialConf, format int) (*proxy.DialConf, error) {
if dc == nil {
dc = &proxy.DialConf{}

View File

@@ -17,10 +17,6 @@ func init() {
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) UseUDPAsMsgConn() bool {
return false
}
// true
func (ClientCreator) MultiTransportLayer() bool {
return true

View File

@@ -20,10 +20,6 @@ func init() {
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) UseUDPAsMsgConn() bool {
return false
}
func (ClientCreator) URLToDialConf(url *url.URL, dc *proxy.DialConf, format int) (*proxy.DialConf, error) {
switch format {
case proxy.UrlStandardFormat:

View File

@@ -18,10 +18,6 @@ func init() {
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) UseUDPAsMsgConn() bool {
return false
}
func (ClientCreator) NewClient(dc *proxy.DialConf) (proxy.Client, error) {
uuidStr := dc.Uuid

View File

@@ -49,10 +49,6 @@ func GetEncryptAlgo(dc *proxy.DialConf) (result string) {
type ClientCreator struct{ proxy.CreatorCommonStruct }
func (ClientCreator) UseUDPAsMsgConn() bool {
return false
}
func (ClientCreator) URLToDialConf(url *url.URL, dc *proxy.DialConf, format int) (*proxy.DialConf, error) {
if format != proxy.UrlStandardFormat {
return dc, utils.ErrUnImplemented