Made App Engine runtime compatible.

This commit is contained in:
Jonathan Gillham 2014-08-29 09:44:41 +01:00 committed by Dave Collins
parent 24a92fd581
commit 47c887338f
3 changed files with 38 additions and 1 deletions

View file

@ -77,7 +77,7 @@ func NewTLSCertPair(organization string, validUntil time.Time, extraHosts []stri
"localhost": true,
}
addrs, err := net.InterfaceAddrs()
addrs, err := interfaceAddrs()
if err != nil {
return nil, nil, err
}

18
net.go Normal file
View file

@ -0,0 +1,18 @@
// Copyright (c) 2013-2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
// +build !appengine
package btcutil
import (
"net"
)
// interfaceAddrs returns a list of the system's network interface addresses.
// It is wrapped here so that we can substitute it for other functions when
// building for systems that do not allow access to net.InterfaceAddrs().
func interfaceAddrs() ([]net.Addr, error) {
return net.InterfaceAddrs()
}

19
net_noop.go Normal file
View file

@ -0,0 +1,19 @@
// Copyright (c) 2013-2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
// +build appengine
package btcutil
import (
"net"
)
// interfaceAddrs returns a list of the system's network interface addresses.
// It is wrapped here so that we can substitute it for a no-op function that
// returns an empty slice of net.Addr when building for systems that do not
// allow access to net.InterfaceAddrs().
func interfaceAddrs() ([]net.Addr, error) {
return []net.Addr{}, nil
}