mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-25 07:20:44 +00:00
socks submodule
This commit is contained in:
13 files changed
+736
-12
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package sender
|
||||
|
||||
import (
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
type Sender interface {
|
||||
SendTo(net.Destination) (internet.Connection, error)
|
||||
}
|
||||
|
||||
type SenderManager struct {
|
||||
}
|
||||
|
||||
func New(space app.Space, config *Config) (*SenderManager, error) {
|
||||
return &SenderManager{}, nil
|
||||
}
|
||||
|
||||
type SenderManagerFactory struct{}
|
||||
|
||||
func (SenderManagerFactory) Create(space app.Space, config interface{}) (app.Application, error) {
|
||||
return New(space, config.(*Config))
|
||||
}
|
||||
|
||||
func FromSpace(space app.Space) *SenderManager {
|
||||
app := space.(app.AppGetter).GetApp(serial.GetMessageType((*Config)(nil)))
|
||||
if app == nil {
|
||||
return nil
|
||||
}
|
||||
return app.(*SenderManager)
|
||||
}
|
||||
|
||||
func init() {
|
||||
common.Must(app.RegisterApplicationFactory((*Config)(nil), SenderManagerFactory{}))
|
||||
}
|
||||
Reference in new issue
Block a user