mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 15:37:33 -05:00
refactor
This commit is contained in:
parent
991cea01ab
commit
26ebd8dde9
@ -6,11 +6,13 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/v2ray/v2ray-core/app"
|
||||||
"github.com/v2ray/v2ray-core/app/dispatcher"
|
"github.com/v2ray/v2ray-core/app/dispatcher"
|
||||||
v2io "github.com/v2ray/v2ray-core/common/io"
|
v2io "github.com/v2ray/v2ray-core/common/io"
|
||||||
"github.com/v2ray/v2ray-core/common/log"
|
"github.com/v2ray/v2ray-core/common/log"
|
||||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||||
"github.com/v2ray/v2ray-core/proxy"
|
"github.com/v2ray/v2ray-core/proxy"
|
||||||
|
"github.com/v2ray/v2ray-core/proxy/internal"
|
||||||
"github.com/v2ray/v2ray-core/proxy/socks/protocol"
|
"github.com/v2ray/v2ray-core/proxy/socks/protocol"
|
||||||
"github.com/v2ray/v2ray-core/transport/hub"
|
"github.com/v2ray/v2ray-core/transport/hub"
|
||||||
)
|
)
|
||||||
@ -292,3 +294,15 @@ func (this *Server) transport(reader io.Reader, writer io.Writer, destination v2
|
|||||||
}()
|
}()
|
||||||
outputFinish.Lock()
|
outputFinish.Lock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
internal.MustRegisterInboundHandlerCreator("socks",
|
||||||
|
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
|
||||||
|
if !space.HasApp(dispatcher.APP_ID) {
|
||||||
|
return nil, internal.ErrorBadConfiguration
|
||||||
|
}
|
||||||
|
return NewServer(
|
||||||
|
rawConfig.(*Config),
|
||||||
|
space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)), nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package socks
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/v2ray/v2ray-core/app"
|
|
||||||
"github.com/v2ray/v2ray-core/app/dispatcher"
|
|
||||||
"github.com/v2ray/v2ray-core/proxy"
|
|
||||||
"github.com/v2ray/v2ray-core/proxy/internal"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
internal.MustRegisterInboundHandlerCreator("socks",
|
|
||||||
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
|
|
||||||
if !space.HasApp(dispatcher.APP_ID) {
|
|
||||||
return nil, internal.ErrorBadConfiguration
|
|
||||||
}
|
|
||||||
return NewServer(
|
|
||||||
rawConfig.(*Config),
|
|
||||||
space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)), nil
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user