Documentation ¶
Overview ¶
Package session provides functions for sessions of incoming requests.
Index ¶
- func AllowedNetworkFromContext(ctx context.Context) net.Network
- func ContextWithAllowedNetwork(ctx context.Context, network net.Network) context.Context
- func ContextWithContent(ctx context.Context, content *Content) context.Context
- func ContextWithDispatcher(ctx context.Context, dispatcher routing.Dispatcher) context.Context
- func ContextWithID(ctx context.Context, id ID) context.Context
- func ContextWithInbound(ctx context.Context, inbound *Inbound) context.Context
- func ContextWithMuxPrefered(ctx context.Context, forced bool) context.Context
- func ContextWithOutbound(ctx context.Context, outbound *Outbound) context.Context
- func ContextWithSockopt(ctx context.Context, s *Sockopt) context.Context
- func ContextWithTimeoutOnly(ctx context.Context, only bool) context.Context
- func DispatcherFromContext(ctx context.Context) routing.Dispatcher
- func ExportIDToError(ctx context.Context) errors.ExportOption
- func GetForcedOutboundTagFromContext(ctx context.Context) string
- func IndependentCancelCtx(parent context.Context) context.Context
- func MuxPreferedFromContext(ctx context.Context) bool
- func SetForcedOutboundTagToContext(ctx context.Context, tag string) context.Context
- func SubmitOutboundErrorToOriginator(ctx context.Context, err error)
- func TimeoutOnlyFromContext(ctx context.Context) bool
- func TrackedConnectionError(ctx context.Context, tracker TrackedRequestErrorFeedback) context.Context
- type Content
- type ID
- type Inbound
- type Outbound
- type SniffingRequest
- type Sockopt
- type TrackedRequestErrorFeedback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithContent ¶
func ContextWithDispatcher ¶
func ContextWithID ¶
ContextWithID returns a new context with the given ID.
func ContextWithInbound ¶
func ContextWithMuxPrefered ¶
ContextWithMuxPrefered returns a new context with the given bool
func ContextWithOutbound ¶
func ContextWithSockopt ¶
ContextWithSockopt returns a new context with Socket configs included
func ContextWithTimeoutOnly ¶
func DispatcherFromContext ¶
func DispatcherFromContext(ctx context.Context) routing.Dispatcher
func ExportIDToError ¶
func ExportIDToError(ctx context.Context) errors.ExportOption
ExportIDToError transfers session.ID into an error object, for logging purpose. This can be used with error.WriteToLog().
func MuxPreferedFromContext ¶
MuxPreferedFromContext returns value in this context, or false if not contained.
func TimeoutOnlyFromContext ¶
func TrackedConnectionError ¶
func TrackedConnectionError(ctx context.Context, tracker TrackedRequestErrorFeedback) context.Context
Types ¶
type Content ¶
type Content struct { // Protocol of current content. Protocol string SniffingRequest SniffingRequest Attributes map[string]string SkipDNSResolve bool }
Content is the metadata of the connection content.
func ContentFromContext ¶
func (*Content) SetAttribute ¶
SetAttribute attaches additional string attributes to content.
type ID ¶
type ID uint32
ID of a session.
func IDFromContext ¶
IDFromContext returns ID in this context, or 0 if not contained.
type Inbound ¶
type Inbound struct { // Source address of the inbound connection. Source net.Destination // Gateway address. Gateway net.Destination // Tag of the inbound proxy that handles the connection. Tag string // Name of the inbound proxy that handles the connection. Name string // User is the user that authencates for the inbound. May be nil if the protocol allows anounymous traffic. User *protocol.MemoryUser // Conn is actually internet.Connection. May be nil. Conn net.Conn // Timer of the inbound buf copier. May be nil. Timer *signal.ActivityTimer }
Inbound is the metadata of an inbound connection.
func InboundFromContext ¶
type Outbound ¶
type Outbound struct { // Target address of the outbound connection. Target net.Destination RouteTarget net.Destination // Gateway address Gateway net.Address }
Outbound is the metadata of an outbound connection.
func OutboundFromContext ¶
type SniffingRequest ¶
type SniffingRequest struct { ExcludeForDomain []string OverrideDestinationForProtocol []string Enabled bool MetadataOnly bool RouteOnly bool }
SniffingRequest controls the behavior of content sniffing.
type Sockopt ¶
type Sockopt struct { // Mark of the socket connection. Mark int32 }
Sockopt is the settings for socket connection.
func SockoptFromContext ¶
SockoptFromContext returns Socket configs in this context, or nil if not contained.
type TrackedRequestErrorFeedback ¶
type TrackedRequestErrorFeedback interface {
SubmitError(err error)
}