Darien Raymond 8 年之前
父节点
当前提交
34ea53e5b7
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      proxy/context.go

+ 2 - 0
proxy/context.go

@@ -17,10 +17,12 @@ const (
 	resolvedIPsKey
 	resolvedIPsKey
 )
 )
 
 
+// ContextWithSource creates a new context with given source.
 func ContextWithSource(ctx context.Context, src net.Destination) context.Context {
 func ContextWithSource(ctx context.Context, src net.Destination) context.Context {
 	return context.WithValue(ctx, sourceKey, src)
 	return context.WithValue(ctx, sourceKey, src)
 }
 }
 
 
+// SourceFromContext retreives source from the given context.
 func SourceFromContext(ctx context.Context) (net.Destination, bool) {
 func SourceFromContext(ctx context.Context) (net.Destination, bool) {
 	v, ok := ctx.Value(sourceKey).(net.Destination)
 	v, ok := ctx.Value(sourceKey).(net.Destination)
 	return v, ok
 	return v, ok