1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-04 17:27:23 -05:00
v2fly/app/dispatcher/dispatcher.go

22 lines
473 B
Go
Raw Normal View History

2016-01-31 11:01:28 -05:00
package dispatcher
import (
"context"
2016-08-20 14:55:45 -04:00
"v2ray.com/core/app"
"v2ray.com/core/common/net"
2016-08-20 14:55:45 -04:00
"v2ray.com/core/transport/ray"
2016-01-31 11:01:28 -05:00
)
2017-01-13 07:53:44 -05:00
// Interface dispatch a packet and possibly further network payload to its destination.
type Interface interface {
Dispatch(ctx context.Context, dest net.Destination) (ray.InboundRay, error)
2016-01-31 11:01:28 -05:00
}
2017-01-06 09:32:36 -05:00
2017-01-13 07:53:44 -05:00
func FromSpace(space app.Space) Interface {
if app := space.GetApplication((*Interface)(nil)); app != nil {
return app.(Interface)
2017-01-06 09:32:36 -05:00
}
return nil
}