-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
621 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package clientcontext | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
type emulatedHeadersKey struct{} | ||
|
||
// GetEmulatedHeadersFromContext returns emulated headers from context. | ||
func GetEmulatedHeadersFromContext(ctx context.Context) (map[string]string, bool) { | ||
if val := ctx.Value(emulatedHeadersKey{}); val != nil { | ||
values, ok := val.(map[string]string) | ||
return values, ok | ||
} | ||
return nil, false | ||
} | ||
|
||
// SetEmulatedHeadersToContext sets header map to context. | ||
func SetEmulatedHeadersToContext(ctx context.Context, h map[string]string) context.Context { | ||
if len(h) == 0 { | ||
return ctx | ||
} | ||
return context.WithValue(ctx, emulatedHeadersKey{}, h) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package config | ||
|
||
const ( | ||
UnifiedProxyName = "unified" | ||
DefaultProxyName = "default" | ||
TransportErrorMode = "transport" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.