v2ray-core/app/dispatcher/dispatcher.go

23 lines
447 B
Go
Raw Normal View History

2016-01-31 17:01:28 +01:00
package dispatcher
import (
"context"
2016-08-20 20:55:45 +02:00
"v2ray.com/core/app"
"v2ray.com/core/transport/ray"
2016-01-31 17:01:28 +01:00
)
2017-01-13 13:53:44 +01:00
// Interface dispatch a packet and possibly further network payload to its destination.
type Interface interface {
DispatchToOutbound(ctx context.Context) ray.InboundRay
2017-02-01 21:35:40 +01:00
Start() error
Close()
2016-01-31 17:01:28 +01:00
}
2017-01-06 15:32:36 +01:00
2017-01-13 13:53:44 +01:00
func FromSpace(space app.Space) Interface {
if app := space.GetApplication((*Interface)(nil)); app != nil {
return app.(Interface)
2017-01-06 15:32:36 +01:00
}
return nil
}