(addr string)
| 110 | } |
| 111 | |
| 112 | func (ctx *context) lookupIPAddr(addr string) net.IP { |
| 113 | ctx.hosts.Lock() |
| 114 | defer ctx.hosts.Unlock() |
| 115 | ip, ok := ctx.hosts.m[addr] |
| 116 | if !ok { |
| 117 | if tcpAddr := utils.ResolveTCPAddrTimeout(addr, 50*time.Millisecond); tcpAddr != nil { |
| 118 | ctx.hosts.m[addr] = tcpAddr.IP |
| 119 | return tcpAddr.IP |
| 120 | } else { |
| 121 | ctx.hosts.m[addr] = nil |
| 122 | return nil |
| 123 | } |
| 124 | } |
| 125 | return ip |
| 126 | } |
| 127 | |
| 128 | func (ctx *context) toReplicaGroups(gid int, p *models.Proxy) [][]string { |
| 129 | g := ctx.group[gid] |