diff --git a/btcutil/go.mod b/btcutil/go.mod index 723a9c97..3b53da6c 100644 --- a/btcutil/go.mod +++ b/btcutil/go.mod @@ -9,6 +9,7 @@ require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 + github.com/kcalvinalvin/anet v0.0.0-20251112173137-d8ddc1f6dbee github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 github.com/stretchr/testify v1.8.4 golang.org/x/crypto v0.25.0 diff --git a/btcutil/go.sum b/btcutil/go.sum index fa59c6a8..9a81f939 100644 --- a/btcutil/go.sum +++ b/btcutil/go.sum @@ -16,6 +16,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/kcalvinalvin/anet v0.0.0-20251112173137-d8ddc1f6dbee h1:FPP9HDkBbPyniu+u7FHZg+kKFX1WW0gxOGteJ0h3AJk= +github.com/kcalvinalvin/anet v0.0.0-20251112173137-d8ddc1f6dbee/go.mod h1:N6sz6HwJAenJ6d+/xmSl0ikfV05ZrVGmjt1ryy/WOtE= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/btcutil/net.go b/btcutil/net.go index ec563862..491e47b5 100644 --- a/btcutil/net.go +++ b/btcutil/net.go @@ -2,8 +2,8 @@ // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. -//go:build !appengine -// +build !appengine +//go:build !android && !appengine +// +build !android,!appengine package btcutil diff --git a/btcutil/net_android.go b/btcutil/net_android.go new file mode 100644 index 00000000..ab99f50b --- /dev/null +++ b/btcutil/net_android.go @@ -0,0 +1,25 @@ +// Copyright (c) 2025 The btcsuite developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +//go:build android +// +build android + +package btcutil + +import ( + "net" + + "github.com/kcalvinalvin/anet" +) + +// InterfaceAddrs returns a list of the system's network interface addresses. +// We specifically wrap anet.InterfaceAddrs as the net pakcage has been broken +// since android 11. +// +// The relevant github issue link is: +// https://github.com/golang/go/issues/40569. +// When the issue is later resolved, we should remove it. +func InterfaceAddrs() ([]net.Addr, error) { + return anet.InterfaceAddrs() +}