mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-01 16:18:24 +00:00
cleanup unused scenarios
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"v2ray.com/core/common/net"
|
||||
)
|
||||
|
||||
type key uint32
|
||||
|
||||
const (
|
||||
resolvedIPsKey key = iota
|
||||
)
|
||||
|
||||
type IPResolver interface {
|
||||
Resolve() []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
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/features/dns"
|
||||
"v2ray.com/core/features/policy"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
@@ -59,14 +58,6 @@ func (h *Handler) policy() policy.Session {
|
||||
}
|
||||
|
||||
func (h *Handler) resolveIP(ctx context.Context, domain string) net.Address {
|
||||
if resolver, ok := proxy.ResolvedIPsFromContext(ctx); ok {
|
||||
ips := resolver.Resolve()
|
||||
if len(ips) == 0 {
|
||||
return nil
|
||||
}
|
||||
return ips[dice.Roll(len(ips))]
|
||||
}
|
||||
|
||||
ips, err := h.dns.LookupIP(domain)
|
||||
if err != nil {
|
||||
newError("failed to get IP address for domain ", domain).Base(err).WriteToLog(session.ExportIDToError(ctx))
|
||||
|
||||
Reference in New Issue
Block a user