mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
btcutil: use anet instead of net for android builds
Golang's net package has been broken for android since android 11 and the node will not be able to call net.InterfaceAddr() without root. For android builds, we use anet so that the btcd node can be used without root.
This commit is contained in:
parent
56613bb876
commit
153bf6d828
4 changed files with 30 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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=
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
25
btcutil/net_android.go
Normal file
25
btcutil/net_android.go
Normal file
|
|
@ -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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue