core: v2ray.com/core/common/session Index | Files

package session

import "v2ray.com/core/common/session"

Package session provides functions for sessions of incoming requests.

Index

Package Files

context.go session.go

func ContextWithContent Uses

func ContextWithContent(ctx context.Context, content *Content) context.Context

func ContextWithID Uses

func ContextWithID(ctx context.Context, id ID) context.Context

ContextWithID returns a new context with the given ID.

func ContextWithInbound Uses

func ContextWithInbound(ctx context.Context, inbound *Inbound) context.Context

func ContextWithOutbound Uses

func ContextWithOutbound(ctx context.Context, outbound *Outbound) context.Context

func ExportIDToError Uses

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().

type Content Uses

type Content struct {
    // Protocol of current content.
    Protocol string

    SniffingRequest SniffingRequest

    Attributes map[string]interface{}
}

Content is the metadata of the connection content.

func ContentFromContext Uses

func ContentFromContext(ctx context.Context) *Content

func (*Content) Attribute Uses

func (c *Content) Attribute(name string) interface{}

func (*Content) SetAttribute Uses

func (c *Content) SetAttribute(name string, value interface{})

type ID Uses

type ID uint32

ID of a session.

func IDFromContext Uses

func IDFromContext(ctx context.Context) ID

IDFromContext returns ID in this context, or 0 if not contained.

func NewID Uses

func NewID() ID

NewID generates a new ID. The generated ID is high likely to be unique, but not cryptographically secure. The generated ID will never be 0.

type Inbound Uses

type Inbound struct {
    // Source address of the inbound connection.
    Source net.Destination
    // Getaway address
    Gateway net.Destination
    // Tag of the inbound proxy that handles the connection.
    Tag string
    // User is the user that authencates for the inbound. May be nil if the protocol allows anounymous traffic.
    User *protocol.MemoryUser
}

Inbound is the metadata of an inbound connection.

func InboundFromContext Uses

func InboundFromContext(ctx context.Context) *Inbound

type Outbound Uses

type Outbound struct {
    // Target address of the outbound connection.
    Target net.Destination
    // Gateway address
    Gateway net.Address
    // ResolvedIPs is the resolved IP addresses, if the Targe is a domain address.
    ResolvedIPs []net.IP
}

Outbound is the metadata of an outbound connection.

func OutboundFromContext Uses

func OutboundFromContext(ctx context.Context) *Outbound

type SniffingRequest Uses

type SniffingRequest struct {
    OverrideDestinationForProtocol []string
    Enabled                        bool
}

Package session imports 5 packages (graph) and is imported by 45 packages. Updated 2019-03-29. Refresh now. Tools for package owners.