From 33becfe553b80da487bf8829a96b5bd331e70f1b Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 15 Oct 2018 08:51:24 +0200 Subject: [PATCH] comments --- app/dispatcher/default.go | 1 + common/session/session.go | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index 1113f3fc6..c1b4e3bf1 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -106,6 +106,7 @@ func NewDefaultDispatcher(ctx context.Context, config *Config) (*DefaultDispatch return d, nil } +// Type implements common.HasType. func (*DefaultDispatcher) Type() interface{} { return routing.DispatcherType() } diff --git a/common/session/session.go b/common/session/session.go index 7c018f0b0..54b36489e 100644 --- a/common/session/session.go +++ b/common/session/session.go @@ -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 { id := IDFromContext(ctx) 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 { - Source net.Destination + // Source address of the inbound connection. + Source net.Destination + // Getaway address 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 *protocol.MemoryUser } +// Outbound is the metadata of an outbound connection. type Outbound struct { - Target net.Destination - Gateway net.Address + // 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 }