2014-06-01 13:50:14 -07:00
|
|
|
// Copyright (C) 2014 Jakob Borg and other contributors. All rights reserved.
|
|
|
|
// Use of this source code is governed by an MIT-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2013-12-15 03:43:31 -07:00
|
|
|
package discover
|
|
|
|
|
|
|
|
import (
|
2014-02-20 09:40:15 -07:00
|
|
|
"encoding/hex"
|
|
|
|
"errors"
|
2013-12-15 03:43:31 -07:00
|
|
|
"fmt"
|
2014-05-11 15:55:43 -07:00
|
|
|
"io"
|
2013-12-15 03:43:31 -07:00
|
|
|
"net"
|
|
|
|
"sync"
|
|
|
|
"time"
|
2013-12-24 09:10:49 -07:00
|
|
|
|
2014-05-14 20:29:18 -07:00
|
|
|
"github.com/calmh/syncthing/beacon"
|
2013-12-15 03:43:31 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
type Discoverer struct {
|
2014-04-16 08:36:09 -07:00
|
|
|
myID string
|
|
|
|
listenAddrs []string
|
|
|
|
localBcastIntv time.Duration
|
|
|
|
globalBcastIntv time.Duration
|
2014-05-14 20:29:18 -07:00
|
|
|
beacon *beacon.Beacon
|
2014-04-16 08:36:09 -07:00
|
|
|
registry map[string][]string
|
|
|
|
registryLock sync.RWMutex
|
|
|
|
extServer string
|
2014-04-18 04:20:42 -07:00
|
|
|
extPort uint16
|
2014-04-16 08:36:09 -07:00
|
|
|
localBcastTick <-chan time.Time
|
|
|
|
forcedBcastTick chan time.Time
|
|
|
|
extAnnounceOK bool
|
|
|
|
extAnnounceOKmut sync.Mutex
|
2013-12-22 14:29:23 -07:00
|
|
|
}
|
|
|
|
|
2014-02-20 09:40:15 -07:00
|
|
|
var (
|
2014-02-24 05:29:30 -07:00
|
|
|
ErrIncorrectMagic = errors.New("incorrect magic number")
|
2014-02-20 09:40:15 -07:00
|
|
|
)
|
|
|
|
|
2013-12-22 15:13:51 -07:00
|
|
|
// We tolerate a certain amount of errors because we might be running on
|
2013-12-18 10:29:15 -07:00
|
|
|
// laptops that sleep and wake, have intermittent network connectivity, etc.
|
|
|
|
// When we hit this many errors in succession, we stop.
|
|
|
|
const maxErrors = 30
|
|
|
|
|
2014-05-22 00:35:54 -07:00
|
|
|
func NewDiscoverer(id string, addresses []string, localPort int) (*Discoverer, error) {
|
|
|
|
b, err := beacon.New(localPort)
|
2014-05-14 11:26:05 -07:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2013-12-15 03:43:31 -07:00
|
|
|
disc := &Discoverer{
|
2014-04-16 08:36:09 -07:00
|
|
|
myID: id,
|
|
|
|
listenAddrs: addresses,
|
|
|
|
localBcastIntv: 30 * time.Second,
|
|
|
|
globalBcastIntv: 1800 * time.Second,
|
2014-05-14 11:26:05 -07:00
|
|
|
beacon: b,
|
2014-04-16 08:36:09 -07:00
|
|
|
registry: make(map[string][]string),
|
2014-03-18 09:51:55 -07:00
|
|
|
}
|
2013-12-15 03:43:31 -07:00
|
|
|
|
2014-03-18 09:51:55 -07:00
|
|
|
go disc.recvAnnouncements()
|
2014-03-03 07:28:10 -07:00
|
|
|
|
2014-04-16 07:49:01 -07:00
|
|
|
return disc, nil
|
|
|
|
}
|
2014-03-03 07:28:10 -07:00
|
|
|
|
2014-04-16 07:49:01 -07:00
|
|
|
func (d *Discoverer) StartLocal() {
|
2014-04-16 08:36:09 -07:00
|
|
|
d.localBcastTick = time.Tick(d.localBcastIntv)
|
|
|
|
d.forcedBcastTick = make(chan time.Time)
|
2014-04-16 07:49:01 -07:00
|
|
|
go d.sendLocalAnnouncements()
|
|
|
|
}
|
2014-03-03 07:28:10 -07:00
|
|
|
|
2014-04-18 04:20:42 -07:00
|
|
|
func (d *Discoverer) StartGlobal(server string, extPort uint16) {
|
2014-04-16 07:49:01 -07:00
|
|
|
d.extServer = server
|
2014-04-18 04:20:42 -07:00
|
|
|
d.extPort = extPort
|
2014-04-16 07:49:01 -07:00
|
|
|
go d.sendExternalAnnouncements()
|
2014-03-18 09:51:55 -07:00
|
|
|
}
|
2014-03-03 07:28:10 -07:00
|
|
|
|
2014-04-16 08:36:09 -07:00
|
|
|
func (d *Discoverer) ExtAnnounceOK() bool {
|
|
|
|
d.extAnnounceOKmut.Lock()
|
|
|
|
defer d.extAnnounceOKmut.Unlock()
|
|
|
|
return d.extAnnounceOK
|
|
|
|
}
|
|
|
|
|
2014-05-01 23:53:19 -07:00
|
|
|
func (d *Discoverer) Lookup(node string) []string {
|
|
|
|
d.registryLock.Lock()
|
|
|
|
addr, ok := d.registry[node]
|
|
|
|
d.registryLock.Unlock()
|
|
|
|
|
|
|
|
if ok {
|
|
|
|
return addr
|
|
|
|
} else if len(d.extServer) != 0 {
|
|
|
|
// We might want to cache this, but not permanently so it needs some intelligence
|
|
|
|
return d.externalLookup(node)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2014-05-12 17:50:54 -07:00
|
|
|
func (d *Discoverer) Hint(node string, addrs []string) {
|
|
|
|
resAddrs := resolveAddrs(addrs)
|
|
|
|
d.registerNode(nil, Node{
|
|
|
|
ID: node,
|
|
|
|
Addresses: resAddrs,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2014-05-12 18:08:55 -07:00
|
|
|
func (d *Discoverer) All() map[string][]string {
|
|
|
|
d.registryLock.RLock()
|
|
|
|
nodes := make(map[string][]string, len(d.registry))
|
|
|
|
for node, addrs := range d.registry {
|
|
|
|
addrsCopy := make([]string, len(addrs))
|
|
|
|
copy(addrsCopy, addrs)
|
|
|
|
nodes[node] = addrsCopy
|
|
|
|
}
|
|
|
|
d.registryLock.RUnlock()
|
|
|
|
return nodes
|
|
|
|
}
|
|
|
|
|
2014-03-18 09:51:55 -07:00
|
|
|
func (d *Discoverer) announcementPkt() []byte {
|
|
|
|
var addrs []Address
|
2014-04-16 08:36:09 -07:00
|
|
|
for _, astr := range d.listenAddrs {
|
2014-03-18 09:51:55 -07:00
|
|
|
addr, err := net.ResolveTCPAddr("tcp", astr)
|
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Warnln("%v: not announcing %s", err, astr)
|
2014-03-18 09:51:55 -07:00
|
|
|
continue
|
|
|
|
} else if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: announcing %s: %#v", astr, addr)
|
2014-03-18 09:51:55 -07:00
|
|
|
}
|
|
|
|
if len(addr.IP) == 0 || addr.IP.IsUnspecified() {
|
|
|
|
addrs = append(addrs, Address{Port: uint16(addr.Port)})
|
|
|
|
} else if bs := addr.IP.To4(); bs != nil {
|
|
|
|
addrs = append(addrs, Address{IP: bs, Port: uint16(addr.Port)})
|
|
|
|
} else if bs := addr.IP.To16(); bs != nil {
|
|
|
|
addrs = append(addrs, Address{IP: bs, Port: uint16(addr.Port)})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var pkt = AnnounceV2{
|
2014-05-11 15:55:43 -07:00
|
|
|
Magic: AnnouncementMagicV2,
|
|
|
|
This: Node{d.myID, addrs},
|
2014-03-18 09:51:55 -07:00
|
|
|
}
|
|
|
|
return pkt.MarshalXDR()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Discoverer) sendLocalAnnouncements() {
|
2014-05-11 15:55:43 -07:00
|
|
|
var addrs = resolveAddrs(d.listenAddrs)
|
|
|
|
|
|
|
|
var pkt = AnnounceV2{
|
|
|
|
Magic: AnnouncementMagicV2,
|
|
|
|
This: Node{d.myID, addrs},
|
|
|
|
}
|
2014-03-03 07:28:10 -07:00
|
|
|
|
2014-03-28 03:04:48 -07:00
|
|
|
for {
|
2014-05-11 15:55:43 -07:00
|
|
|
pkt.Extra = nil
|
|
|
|
d.registryLock.RLock()
|
|
|
|
for node, addrs := range d.registry {
|
|
|
|
if len(pkt.Extra) == 16 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
anode := Node{node, resolveAddrs(addrs)}
|
|
|
|
pkt.Extra = append(pkt.Extra, anode)
|
|
|
|
}
|
|
|
|
d.registryLock.RUnlock()
|
|
|
|
|
|
|
|
d.beacon.Send(pkt.MarshalXDR())
|
2014-02-23 07:01:37 -07:00
|
|
|
|
|
|
|
select {
|
2014-04-16 08:36:09 -07:00
|
|
|
case <-d.localBcastTick:
|
|
|
|
case <-d.forcedBcastTick:
|
2014-02-23 07:01:37 -07:00
|
|
|
}
|
2014-02-23 06:48:56 -07:00
|
|
|
}
|
2013-12-22 14:29:23 -07:00
|
|
|
}
|
2013-12-15 03:43:31 -07:00
|
|
|
|
2014-03-18 09:51:55 -07:00
|
|
|
func (d *Discoverer) sendExternalAnnouncements() {
|
2014-02-23 06:48:56 -07:00
|
|
|
remote, err := net.ResolveUDPAddr("udp", d.extServer)
|
2013-12-22 14:29:23 -07:00
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Warnf("Global discovery: %v; no external announcements", err)
|
2013-12-22 14:29:23 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2014-03-18 09:51:55 -07:00
|
|
|
conn, err := net.ListenUDP("udp", nil)
|
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Warnf("Global discovery: %v; no external announcements", err)
|
2014-03-18 09:51:55 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2014-04-18 04:20:42 -07:00
|
|
|
var buf []byte
|
|
|
|
if d.extPort != 0 {
|
|
|
|
var pkt = AnnounceV2{
|
2014-05-11 15:55:43 -07:00
|
|
|
Magic: AnnouncementMagicV2,
|
|
|
|
This: Node{d.myID, []Address{{Port: d.extPort}}},
|
2014-04-18 04:20:42 -07:00
|
|
|
}
|
|
|
|
buf = pkt.MarshalXDR()
|
|
|
|
} else {
|
|
|
|
buf = d.announcementPkt()
|
|
|
|
}
|
2014-02-23 06:48:56 -07:00
|
|
|
|
2014-05-27 22:03:47 -07:00
|
|
|
for {
|
2014-04-16 08:36:09 -07:00
|
|
|
var ok bool
|
|
|
|
|
2014-03-09 00:58:03 -07:00
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: send announcement -> %v\n%s", remote, hex.Dump(buf))
|
2014-02-23 06:48:56 -07:00
|
|
|
}
|
2014-04-16 08:36:09 -07:00
|
|
|
|
2014-03-18 09:51:55 -07:00
|
|
|
_, err = conn.WriteTo(buf, remote)
|
2013-12-15 03:43:31 -07:00
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugln("discover: warning:", err)
|
|
|
|
}
|
2014-04-16 08:36:09 -07:00
|
|
|
ok = false
|
2013-12-18 10:29:15 -07:00
|
|
|
} else {
|
2014-04-16 08:36:09 -07:00
|
|
|
// Verify that the announce server responds positively for our node ID
|
|
|
|
|
2014-04-16 06:06:54 -07:00
|
|
|
time.Sleep(1 * time.Second)
|
2014-04-16 08:36:09 -07:00
|
|
|
res := d.externalLookup(d.myID)
|
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugln("discover: external lookup check:", res)
|
2014-04-16 08:36:09 -07:00
|
|
|
}
|
|
|
|
ok = len(res) > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
d.extAnnounceOKmut.Lock()
|
|
|
|
d.extAnnounceOK = ok
|
|
|
|
d.extAnnounceOKmut.Unlock()
|
|
|
|
|
|
|
|
if ok {
|
|
|
|
time.Sleep(d.globalBcastIntv)
|
|
|
|
} else {
|
|
|
|
time.Sleep(60 * time.Second)
|
2014-04-16 06:06:54 -07:00
|
|
|
}
|
2013-12-15 03:43:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Discoverer) recvAnnouncements() {
|
2014-03-28 03:04:48 -07:00
|
|
|
for {
|
|
|
|
buf, addr := d.beacon.Recv()
|
2013-12-22 14:29:23 -07:00
|
|
|
|
2014-03-09 00:58:03 -07:00
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: read announcement:\n%s", hex.Dump(buf))
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var pkt AnnounceV2
|
2014-03-28 03:04:48 -07:00
|
|
|
err := pkt.UnmarshalXDR(buf)
|
2014-05-11 15:55:43 -07:00
|
|
|
if err != nil && err != io.EOF {
|
2013-12-15 03:43:31 -07:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2014-03-09 00:58:03 -07:00
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: parsed announcement: %#v", pkt)
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
|
2014-05-11 15:55:43 -07:00
|
|
|
var newNode bool
|
|
|
|
if pkt.This.ID != d.myID {
|
|
|
|
n := d.registerNode(addr, pkt.This)
|
|
|
|
newNode = newNode || n
|
2014-05-14 11:26:05 -07:00
|
|
|
for _, node := range pkt.Extra {
|
|
|
|
if node.ID != d.myID {
|
|
|
|
n := d.registerNode(nil, node)
|
|
|
|
newNode = newNode || n
|
|
|
|
}
|
2013-12-15 03:43:31 -07:00
|
|
|
}
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if newNode {
|
|
|
|
select {
|
|
|
|
case d.forcedBcastTick <- time.Now():
|
2014-02-23 07:01:37 -07:00
|
|
|
}
|
2013-12-15 03:43:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-11 15:55:43 -07:00
|
|
|
func (d *Discoverer) registerNode(addr net.Addr, node Node) bool {
|
|
|
|
var addrs []string
|
|
|
|
for _, a := range node.Addresses {
|
|
|
|
var nodeAddr string
|
|
|
|
if len(a.IP) > 0 {
|
|
|
|
nodeAddr = fmt.Sprintf("%s:%d", net.IP(a.IP), a.Port)
|
|
|
|
addrs = append(addrs, nodeAddr)
|
|
|
|
} else if addr != nil {
|
|
|
|
ua := addr.(*net.UDPAddr)
|
|
|
|
ua.Port = int(a.Port)
|
|
|
|
nodeAddr = ua.String()
|
|
|
|
addrs = append(addrs, nodeAddr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(addrs) == 0 {
|
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugln("discover: no valid address for", node.ID)
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: register: %s -> %#v", node.ID, addrs)
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
|
|
|
d.registryLock.Lock()
|
|
|
|
_, seen := d.registry[node.ID]
|
|
|
|
d.registry[node.ID] = addrs
|
|
|
|
d.registryLock.Unlock()
|
|
|
|
return !seen
|
|
|
|
}
|
|
|
|
|
2014-02-20 09:40:15 -07:00
|
|
|
func (d *Discoverer) externalLookup(node string) []string {
|
2014-01-26 06:28:41 -07:00
|
|
|
extIP, err := net.ResolveUDPAddr("udp", d.extServer)
|
2013-12-22 19:35:05 -07:00
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugf("discover: %v; no external lookup", err)
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-22 19:35:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
conn, err := net.DialUDP("udp", nil, extIP)
|
2013-12-22 15:13:51 -07:00
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugf("discover: %v; no external lookup", err)
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-22 14:29:23 -07:00
|
|
|
}
|
2013-12-24 09:10:49 -07:00
|
|
|
defer conn.Close()
|
2013-12-22 14:29:23 -07:00
|
|
|
|
2013-12-24 09:10:49 -07:00
|
|
|
err = conn.SetDeadline(time.Now().Add(5 * time.Second))
|
2013-12-22 19:35:05 -07:00
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugf("discover: %v; no external lookup", err)
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-22 19:35:05 -07:00
|
|
|
}
|
|
|
|
|
2014-02-20 09:40:15 -07:00
|
|
|
buf := QueryV2{QueryMagicV2, node}.MarshalXDR()
|
|
|
|
_, err = conn.Write(buf)
|
2013-12-24 09:10:49 -07:00
|
|
|
if err != nil {
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugf("discover: %v; no external lookup", err)
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-24 09:10:49 -07:00
|
|
|
}
|
2013-12-22 14:29:23 -07:00
|
|
|
|
2014-06-18 14:57:22 -07:00
|
|
|
buf = make([]byte, 2048)
|
2013-12-24 09:10:49 -07:00
|
|
|
n, err := conn.Read(buf)
|
|
|
|
if err != nil {
|
2013-12-24 09:15:21 -07:00
|
|
|
if err, ok := err.(net.Error); ok && err.Timeout() {
|
|
|
|
// Expected if the server doesn't know about requested node ID
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-24 09:15:21 -07:00
|
|
|
}
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugf("discover: %v; no external lookup", err)
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-24 09:10:49 -07:00
|
|
|
}
|
2013-12-22 14:29:23 -07:00
|
|
|
|
2014-03-09 00:58:03 -07:00
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: read external:\n%s", hex.Dump(buf[:n]))
|
2014-02-20 09:40:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var pkt AnnounceV2
|
|
|
|
err = pkt.UnmarshalXDR(buf[:n])
|
2014-05-11 15:55:43 -07:00
|
|
|
if err != nil && err != io.EOF {
|
2014-05-14 17:08:56 -07:00
|
|
|
if debug {
|
|
|
|
l.Debugln("discover:", err)
|
|
|
|
}
|
2014-02-20 09:40:15 -07:00
|
|
|
return nil
|
2013-12-24 09:10:49 -07:00
|
|
|
}
|
2013-12-22 14:29:23 -07:00
|
|
|
|
2014-03-09 00:58:03 -07:00
|
|
|
if debug {
|
2014-05-14 17:08:56 -07:00
|
|
|
l.Debugf("discover: parsed external: %#v", pkt)
|
2013-12-22 14:29:23 -07:00
|
|
|
}
|
2013-12-24 09:10:49 -07:00
|
|
|
|
2014-02-20 09:40:15 -07:00
|
|
|
var addrs []string
|
2014-05-11 15:55:43 -07:00
|
|
|
for _, a := range pkt.This.Addresses {
|
2014-05-01 23:53:19 -07:00
|
|
|
nodeAddr := fmt.Sprintf("%s:%d", net.IP(a.IP), a.Port)
|
2014-02-20 09:40:15 -07:00
|
|
|
addrs = append(addrs, nodeAddr)
|
|
|
|
}
|
|
|
|
return addrs
|
2013-12-22 14:29:23 -07:00
|
|
|
}
|
2014-05-11 15:55:43 -07:00
|
|
|
|
|
|
|
func addrToAddr(addr *net.TCPAddr) Address {
|
|
|
|
if len(addr.IP) == 0 || addr.IP.IsUnspecified() {
|
|
|
|
return Address{Port: uint16(addr.Port)}
|
|
|
|
} else if bs := addr.IP.To4(); bs != nil {
|
|
|
|
return Address{IP: bs, Port: uint16(addr.Port)}
|
|
|
|
} else if bs := addr.IP.To16(); bs != nil {
|
|
|
|
return Address{IP: bs, Port: uint16(addr.Port)}
|
|
|
|
}
|
|
|
|
return Address{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func resolveAddrs(addrs []string) []Address {
|
|
|
|
var raddrs []Address
|
|
|
|
for _, addrStr := range addrs {
|
|
|
|
addrRes, err := net.ResolveTCPAddr("tcp", addrStr)
|
|
|
|
if err != nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
addr := addrToAddr(addrRes)
|
|
|
|
if len(addr.IP) > 0 {
|
|
|
|
raddrs = append(raddrs, addr)
|
2014-05-16 07:28:52 -07:00
|
|
|
} else {
|
|
|
|
raddrs = append(raddrs, Address{Port: addr.Port})
|
2014-05-11 15:55:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return raddrs
|
|
|
|
}
|