1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

remove unused code

This commit is contained in:
Darien Raymond 2018-01-10 13:30:57 +01:00
parent ec54b04537
commit 7d2c34f674
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 2 additions and 44 deletions

View File

@ -1,44 +0,0 @@
package net
import (
"net"
"sync/atomic"
"unsafe"
)
// IPResolver is the interface to resolve host name to IPs.
type IPResolver interface {
LookupIP(host string) ([]net.IP, error)
}
type systemIPResolver int
func (s systemIPResolver) LookupIP(host string) ([]net.IP, error) {
return net.LookupIP(host)
}
const (
systemIPResolverInstance = systemIPResolver(0)
)
// SystemIPResolver returns an IPResolver that resolves IP through underlying system.
func SystemIPResolver() IPResolver {
return systemIPResolverInstance
}
var (
ipResolver unsafe.Pointer
)
func LookupIP(host string) ([]net.IP, error) {
r := (*IPResolver)(atomic.LoadPointer(&ipResolver))
return (*r).LookupIP(host)
}
func RegisterIPResolver(resolver IPResolver) {
atomic.StorePointer(&ipResolver, unsafe.Pointer(&resolver))
}
func init() {
RegisterIPResolver(systemIPResolverInstance)
}

View File

@ -11,6 +11,8 @@ var Listen = net.Listen
var ListenTCP = net.ListenTCP
var ListenUDP = net.ListenUDP
var LookupIP = net.LookupIP
var FileConn = net.FileConn
var ParseIP = net.ParseIP