github.com/xmplusdev/xray-core@v1.8.10/features/routing/context.go (about)

     1  package routing
     2  
     3  import (
     4  	"github.com/xmplusdev/xray-core/common/net"
     5  )
     6  
     7  // Context is a feature to store connection information for routing.
     8  //
     9  // xray:api:stable
    10  type Context interface {
    11  	// GetInboundTag returns the tag of the inbound the connection was from.
    12  	GetInboundTag() string
    13  
    14  	// GetSourcesIPs returns the source IPs bound to the connection.
    15  	GetSourceIPs() []net.IP
    16  
    17  	// GetSourcePort returns the source port of the connection.
    18  	GetSourcePort() net.Port
    19  
    20  	// GetTargetIPs returns the target IP of the connection or resolved IPs of target domain.
    21  	GetTargetIPs() []net.IP
    22  
    23  	// GetTargetPort returns the target port of the connection.
    24  	GetTargetPort() net.Port
    25  
    26  	// GetTargetDomain returns the target domain of the connection, if exists.
    27  	GetTargetDomain() string
    28  
    29  	// GetNetwork returns the network type of the connection.
    30  	GetNetwork() net.Network
    31  
    32  	// GetProtocol returns the protocol from the connection content, if sniffed out.
    33  	GetProtocol() string
    34  
    35  	// GetUser returns the user email from the connection content, if exists.
    36  	GetUser() string
    37  
    38  	// GetAttributes returns extra attributes from the conneciont content.
    39  	GetAttributes() map[string]string
    40  
    41  	// GetSkipDNSResolve returns a flag switch for weather skip dns resolve during route pick.
    42  	GetSkipDNSResolve() bool
    43  }