1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-26 09:25:23 +00:00
This commit is contained in:
Darien Raymond 2018-10-15 08:51:24 +02:00
parent 595f3d685e
commit 33becfe553
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 15 additions and 4 deletions

View File

@ -106,6 +106,7 @@ func NewDefaultDispatcher(ctx context.Context, config *Config) (*DefaultDispatch
return d, nil return d, nil
} }
// Type implements common.HasType.
func (*DefaultDispatcher) Type() interface{} { func (*DefaultDispatcher) Type() interface{} {
return routing.DispatcherType() return routing.DispatcherType()
} }

View File

@ -24,6 +24,8 @@ func NewID() ID {
} }
} }
// ExportIDToError transfers session.ID into an error object, for logging purpose.
// This can be used with error.WriteToLog().
func ExportIDToError(ctx context.Context) errors.ExportOption { func ExportIDToError(ctx context.Context) errors.ExportOption {
id := IDFromContext(ctx) id := IDFromContext(ctx)
return func(h *errors.ExportOptionHolder) { return func(h *errors.ExportOptionHolder) {
@ -31,16 +33,24 @@ func ExportIDToError(ctx context.Context) errors.ExportOption {
} }
} }
// Inbound is the metadata of an inbound connection.
type Inbound struct { type Inbound struct {
Source net.Destination // Source address of the inbound connection.
Source net.Destination
// Getaway address
Gateway net.Destination Gateway net.Destination
Tag string // 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 is the user that authencates for the inbound. May be nil if the protocol allows anounymous traffic.
User *protocol.MemoryUser User *protocol.MemoryUser
} }
// Outbound is the metadata of an outbound connection.
type Outbound struct { type Outbound struct {
Target net.Destination // Target address of the outbound connection.
Gateway net.Address Target net.Destination
// Gateway address
Gateway net.Address
// ResolvedIPs is the resolved IP addresses, if the Targe is a domain address.
ResolvedIPs []net.IP ResolvedIPs []net.IP
} }