| 1 | package routingscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/ |
| 2 | |
| 3 | import ( |
| 4 | "v2ray.com/core/commonscip-go gomod v2ray.com/core . `v2ray.com/core/common`/" |
| 5 | "v2ray.com/core/featuresscip-go gomod v2ray.com/core . `v2ray.com/core/features`/" |
| 6 | ) |
| 7 | |
| 8 | // Router is a feature to choose an outbound tag for the given request. |
| 9 | // |
| 10 | // v2ray:api:stable |
| 11 | type Routerscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Router# interface { |
| 12 | featuresscip-go gomod v2ray.com/core . `v2ray.com/core/features`/.Featurescip-go gomod v2ray.com/core . `v2ray.com/core/features`/Feature# |
| 13 | |
| 14 | // PickRoute returns a route decision based on the given routing context. |
| 15 | PickRoutescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Router#PickRoute.(ctx Contextscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Context#) (Routescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Route#, error) |
| 16 | } |
| 17 | |
| 18 | // Route is the routing result of Router feature. |
| 19 | // |
| 20 | // v2ray:api:stable |
| 21 | type Routescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Route# interface { |
| 22 | // A Route is also a routing context. |
| 23 | Contextscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Context# |
| 24 | |
| 25 | // GetOutboundGroupTags returns the detoured outbound group tags in sequence before a final outbound is chosen. |
| 26 | GetOutboundGroupTagsscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Route#GetOutboundGroupTags.() []string |
| 27 | |
| 28 | // GetOutboundTag returns the tag of the outbound the connection was dispatched to. |
| 29 | GetOutboundTagscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Route#GetOutboundTag.() string |
| 30 | } |
| 31 | |
| 32 | // RouterType return the type of Router interface. Can be used to implement common.HasType. |
| 33 | // |
| 34 | // v2ray:api:stable |
| 35 | func RouterTypescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/RouterType().() interface{} { |
| 36 | return (*Routerscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Router#)(nil) |
| 37 | } |
| 38 | |
| 39 | // DefaultRouter is an implementation of Router, which always returns ErrNoClue for routing decisions. |
| 40 | type DefaultRouterscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter# struct{} |
| 41 | |
| 42 | // Type implements common.HasType. |
| 43 | func (DefaultRouterscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#) Typescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#Type().() interface{} { |
| 44 | return RouterTypescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/RouterType().() |
| 45 | } |
| 46 | |
| 47 | // PickRoute implements Router. |
| 48 | func (DefaultRouterscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#) PickRoutescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#PickRoute().(ctx Contextscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Context#) (Routescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/Route#, error) { |
| 49 | return nil, commonscip-go gomod v2ray.com/core . `v2ray.com/core/common`/.ErrNoCluescip-go gomod v2ray.com/core . `v2ray.com/core/common`/ErrNoClue. |
| 50 | } |
| 51 | |
| 52 | // Start implements common.Runnable. |
| 53 | func (DefaultRouterscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#) Startscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#Start().() error { |
| 54 | return nil |
| 55 | } |
| 56 | |
| 57 | // Close implements common.Closable. |
| 58 | func (DefaultRouterscip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#) Closescip-go gomod v2ray.com/core . `v2ray.com/core/features/routing`/DefaultRouter#Close().() error { |
| 59 | return nil |
| 60 | } |