1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-23 02:26:49 -05:00
v2fly/features/outbound/outbound.go

46 lines
1.2 KiB
Go
Raw Normal View History

package outbound
import (
"context"
"v2ray.com/core/common"
"v2ray.com/core/features"
2018-11-03 07:36:29 -04:00
"v2ray.com/core/transport"
)
// Handler is the interface for handlers that process outbound connections.
2018-12-03 16:44:42 -05:00
//
// v2ray:api:stable
type Handler interface {
common.Runnable
Tag() string
2018-11-03 07:36:29 -04:00
Dispatch(ctx context.Context, link *transport.Link)
}
2018-11-07 15:08:20 -05:00
type HandlerSelector interface {
Select([]string) []string
}
2018-10-12 17:57:56 -04:00
// Manager is a feature that manages outbound.Handlers.
2018-12-03 16:44:42 -05:00
//
// v2ray:api:stable
2018-10-12 17:57:56 -04:00
type Manager interface {
features.Feature
// GetHandler returns an outbound.Handler for the given tag.
GetHandler(tag string) Handler
// GetDefaultHandler returns the default outbound.Handler. It is usually the first outbound.Handler specified in the configuration.
GetDefaultHandler() Handler
2018-10-12 17:57:56 -04:00
// AddHandler adds a handler into this outbound.Manager.
AddHandler(ctx context.Context, handler Handler) error
2018-10-12 17:57:56 -04:00
// RemoveHandler removes a handler from outbound.Manager.
RemoveHandler(ctx context.Context, tag string) error
}
2018-10-12 17:57:56 -04:00
2018-10-13 09:15:49 -04:00
// ManagerType returns the type of Manager interface. Can be used to implement common.HasType.
2018-12-03 16:44:42 -05:00
//
// v2ray:api:stable
2018-10-12 17:57:56 -04:00
func ManagerType() interface{} {
return (*Manager)(nil)
}