mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-09-07 20:45:19 -04:00
move link to transport
This commit is contained in:
parent
25e7fa3ade
commit
128a90b98b
@ -7,7 +7,7 @@ import (
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/signal/done"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/transport"
|
||||
"v2ray.com/core/transport/pipe"
|
||||
)
|
||||
|
||||
@ -69,7 +69,7 @@ type Outbound struct {
|
||||
}
|
||||
|
||||
// Dispatch implements outbound.Handler.
|
||||
func (co *Outbound) Dispatch(ctx context.Context, link *vio.Link) {
|
||||
func (co *Outbound) Dispatch(ctx context.Context, link *transport.Link) {
|
||||
co.access.RLock()
|
||||
|
||||
if co.closed {
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"v2ray.com/core/features/policy"
|
||||
"v2ray.com/core/features/routing"
|
||||
"v2ray.com/core/features/stats"
|
||||
"v2ray.com/core/transport"
|
||||
"v2ray.com/core/transport/pipe"
|
||||
)
|
||||
|
||||
@ -124,17 +125,17 @@ func (*DefaultDispatcher) Start() error {
|
||||
// Close implements common.Closable.
|
||||
func (*DefaultDispatcher) Close() error { return nil }
|
||||
|
||||
func (d *DefaultDispatcher) getLink(ctx context.Context) (*vio.Link, *vio.Link) {
|
||||
func (d *DefaultDispatcher) getLink(ctx context.Context) (*transport.Link, *transport.Link) {
|
||||
opt := pipe.OptionsFromContext(ctx)
|
||||
uplinkReader, uplinkWriter := pipe.New(opt...)
|
||||
downlinkReader, downlinkWriter := pipe.New(opt...)
|
||||
|
||||
inboundLink := &vio.Link{
|
||||
inboundLink := &transport.Link{
|
||||
Reader: downlinkReader,
|
||||
Writer: uplinkWriter,
|
||||
}
|
||||
|
||||
outboundLink := &vio.Link{
|
||||
outboundLink := &transport.Link{
|
||||
Reader: uplinkReader,
|
||||
Writer: downlinkWriter,
|
||||
}
|
||||
@ -180,7 +181,7 @@ func shouldOverride(result SniffResult, domainOverride []string) bool {
|
||||
}
|
||||
|
||||
// Dispatch implements routing.Dispatcher.
|
||||
func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destination) (*vio.Link, error) {
|
||||
func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destination) (*transport.Link, error) {
|
||||
if !destination.IsValid() {
|
||||
panic("Dispatcher: Invalid destination.")
|
||||
}
|
||||
@ -245,7 +246,7 @@ func sniffer(ctx context.Context, cReader *cachedReader) (SniffResult, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *vio.Link, destination net.Destination) {
|
||||
func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.Link, destination net.Destination) {
|
||||
dispatcher := d.ohm.GetDefaultHandler()
|
||||