mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-06-17 16:29:55 -04:00
resolve to ip on demand
This commit is contained in:
@@ -64,11 +64,15 @@ func InboundTagFromContext(ctx context.Context) (string, bool) {
|
||||
return v, ok
|
||||
}
|
||||
|
||||
func ContextWithResolveIPs(ctx context.Context, ips []net.Address) context.Context {
|
||||
return context.WithValue(ctx, resolvedIPsKey, ips)
|
||||
type IPResolver interface {
|
||||
Resolve() []net.Address
|
||||
}
|
||||
|
||||
func ResolvedIPsFromContext(ctx context.Context) ([]net.Address, bool) {
|
||||
ips, ok := ctx.Value(resolvedIPsKey).([]net.Address)
|
||||
func ContextWithResolveIPs(ctx context.Context, f IPResolver) context.Context {
|
||||
return context.WithValue(ctx, resolvedIPsKey, f)
|
||||
}
|
||||
|
||||
func ResolvedIPsFromContext(ctx context.Context) (IPResolver, bool) {
|
||||
ips, ok := ctx.Value(resolvedIPsKey).(IPResolver)
|
||||
return ips, ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user