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.
v2ray-core/app/sender/stream_sender.go

26 lines
565 B

8 years ago
package sender
import (
"v2ray.com/core/app"
"v2ray.com/core/common/net"
"v2ray.com/core/transport/internet"
)
type StreamSender struct {
config *StreamSenderConfig
}
func NewStreamSender(config *StreamSenderConfig, space app.Space) *StreamSender {
return &StreamSender{
config: config,
}
}
func (s *StreamSender) SendTo(destination net.Destination) (internet.Connection, error) {
src := s.config.Via.AsAddress()
return internet.Dial(src, destination, internet.DialerOptions{
Stream: s.config.StreamSettings,
Proxy: s.config.ProxySettings,
})
}