Compare commits

...

1 Commits

Author SHA1 Message Date
Preston Van Loon
0834769c73 Hack asn-util. Ref: https://github.com/libp2p/go-libp2p/issues/2664 2023-12-11 09:21:18 -06:00
2 changed files with 34 additions and 0 deletions

View File

@@ -2578,8 +2578,16 @@ def prysm_deps():
version = "v0.27.8",
)
go_repository(
# This library accounts for a significant wall time in production builds. It is not used by
# Prysm at this time.
# See https://github.com/libp2p/go-libp2p/issues/2664
name = "com_github_libp2p_go_libp2p_asn_util",
build_directives = [
"gazelle:exclude ipv6_asn_map.gen.go",
],
importpath = "github.com/libp2p/go-libp2p-asn-util",
patch_args = ["-p1"],
patches = ["//third_party:com_github_libp2p_go_libp2p_asn_util.patch"],
sum = "h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s=",
version = "v0.3.0",
)

View File

@@ -0,0 +1,26 @@
diff --git a/asn.go b/asn.go
index 490b4a2..fcfb0da 100644
--- a/asn.go
+++ b/asn.go
@@ -51,20 +51,7 @@ func (a *asnStore) AsnForIPv6(ip net.IP) (string, error) {
}
func newAsnStore() (*asnStore, error) {
- cr := cidranger.NewPCTrieRanger()
-
- for _, v := range ipv6CidrToAsnPairList {
- _, nn, err := net.ParseCIDR(v.cidr)
- if err != nil {
- return nil, fmt.Errorf("failed to parse CIDR %s: %w", v.cidr, err)
- }
-
- if err := cr.Insert(&networkWithAsn{*nn, v.asn}); err != nil {
- return nil, fmt.Errorf("failed to insert CIDR %s in Trie store: %w", v.cidr, err)
- }
- }
-
- return &asnStore{cr}, nil
+ return nil, errors.New("asnutil store is empty because it is never used and causes significant build delays")
}
// lazyAsnStore builds the underlying trie on first call to AsnForIPv6.