github.com/eagleql/xray-core@v1.4.4/features/inbound/inbound.go (about)

     1  package inbound
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/eagleql/xray-core/common"
     7  	"github.com/eagleql/xray-core/common/net"
     8  	"github.com/eagleql/xray-core/features"
     9  )
    10  
    11  // Handler is the interface for handlers that process inbound connections.
    12  //
    13  // xray:api:stable
    14  type Handler interface {
    15  	common.Runnable
    16  	// The tag of this handler.
    17  	Tag() string
    18  
    19  	// Deprecated: Do not use in new code.
    20  	GetRandomInboundProxy() (interface{}, net.Port, int)
    21  }
    22  
    23  // Manager is a feature that manages InboundHandlers.
    24  //
    25  // xray:api:stable
    26  type Manager interface {
    27  	features.Feature
    28  	// GetHandlers returns an InboundHandler for the given tag.
    29  	GetHandler(ctx context.Context, tag string) (Handler, error)
    30  	// AddHandler adds the given handler into this Manager.
    31  	AddHandler(ctx context.Context, handler Handler) error
    32  
    33  	// RemoveHandler removes a handler from Manager.
    34  	RemoveHandler(ctx context.Context, tag string) error
    35  }
    36  
    37  // ManagerType returns the type of Manager interface. Can be used for implementing common.HasType.
    38  //
    39  // xray:api:stable
    40  func ManagerType() interface{} {
    41  	return (*Manager)(nil)
    42  }