mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-23 00:51:28 +00:00
19 lines
392 B
Go
19 lines
392 B
Go
|
package internet
|
||
|
|
||
|
import "context"
|
||
|
|
||
|
type systemDialer int
|
||
|
|
||
|
const systemDialerKey systemDialer = 0
|
||
|
|
||
|
func ContextWithLookupDomain(ctx context.Context, domain string) context.Context {
|
||
|
return context.WithValue(ctx, systemDialerKey, domain)
|
||
|
}
|
||
|
|
||
|
func LookupDomainFromContext(ctx context.Context) string {
|
||
|
if domain, ok := ctx.Value(systemDialerKey).(string); ok {
|
||
|
return domain
|
||
|
}
|
||
|
return ""
|
||
|
}
|