mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
793 B
40 lines
793 B
package sender
|
|
|
|
import (
|
|
"context"
|
|
|
|
"v2ray.com/core/app"
|
|
"v2ray.com/core/common"
|
|
"v2ray.com/core/common/net"
|
|
"v2ray.com/core/transport/internet"
|
|
)
|
|
|
|
type Sender interface {
|
|
SendTo(net.Destination) (internet.Connection, error)
|
|
}
|
|
|
|
type SenderManager struct {
|
|
}
|
|
|
|
func New(ctx context.Context, config *Config) (*SenderManager, error) {
|
|
return &SenderManager{}, nil
|
|
}
|
|
|
|
func (SenderManager) Interface() interface{} {
|
|
return (*SenderManager)(nil)
|
|
}
|
|
|
|
func FromSpace(space app.Space) *SenderManager {
|
|
app := space.GetApplication((*SenderManager)(nil))
|
|
if app == nil {
|
|
return nil
|
|
}
|
|
return app.(*SenderManager)
|
|
}
|
|
|
|
func init() {
|
|
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
|
|
return New(ctx, config.(*Config))
|
|
}))
|
|
}
|