Unverified Commit 1ac4f05d authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #26 from ipfs/chore/update-libp2p

chore(dep): update libp2p & protobuf
parents 67f9e24f e8c47138
......@@ -4,13 +4,12 @@ os:
language: go
go:
- 1.11.x
- 1.13.x
env:
global:
- GOTFLAGS="-race"
matrix:
- BUILD_DEPTYPE=gx
- BUILD_DEPTYPE=gomod
......@@ -24,7 +23,6 @@ script:
cache:
directories:
- $GOPATH/src/gx
- $GOPATH/pkg/mod
- $HOME/.cache/go-build
......
......@@ -6,7 +6,7 @@ import (
pb "github.com/ipfs/go-ipns/pb"
ipns "github.com/ipfs/go-ipns"
crypto "github.com/libp2p/go-libp2p-crypto"
crypto "github.com/libp2p/go-libp2p-core/crypto"
)
// CreateEntryWithEmbed shows how you can create an IPNS entry
......
......@@ -4,7 +4,7 @@ import (
"testing"
"github.com/ipfs/go-ipns/examples"
crypto "github.com/libp2p/go-libp2p-crypto"
crypto "github.com/libp2p/go-libp2p-core/crypto"
)
var testPath = "/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5"
......@@ -43,9 +43,7 @@ func TestEmbeddedEntryCreation(t *testing.T) {
}
func generateRSAKey() (crypto.PrivKey, error) {
// DO NOT USE 1024 BITS IN PRODUCTION
// THIS IS ONLY FOR TESTING PURPOSES
k, err := examples.GenerateRSAKeyPair(1024)
k, err := examples.GenerateRSAKeyPair(2048)
if err != nil {
return nil, err
}
......
package examples
import (
crypto "github.com/libp2p/go-libp2p-crypto"
crypto "github.com/libp2p/go-libp2p-core/crypto"
)
// GenerateRSAKeyPair is used to generate an RSA key pair
......
This diff is collapsed.
......@@ -8,8 +8,8 @@ import (
pb "github.com/ipfs/go-ipns/pb"
u "github.com/ipfs/go-ipfs-util"
ic "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
ic "github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
)
// Create creates a new IPNS entry and signs it with the given private key.
......
......@@ -6,14 +6,14 @@ import (
"time"
u "github.com/ipfs/go-ipfs-util"
ci "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
ci "github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
)
func TestEmbedPublicKey(t *testing.T) {
sr := u.NewTimeSeededRand()
priv, pub, err := ci.GenerateKeyPairWithReader(ci.RSA, 1024, sr)
priv, pub, err := ci.GenerateKeyPairWithReader(ci.RSA, 2048, sr)
if err != nil {
t.Fatal(err)
}
......
{
"author": "stebalien",
"bugs": {
"url": "https://github.com/ipfs/go-ipns/issues"
},
"gx": {
"dvcsimport": "github.com/ipfs/go-ipns"
},
"gxDependencies": [
{
"author": "whyrusleeping",
"hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz",
"name": "go-ipfs-util",
"version": "1.2.9"
},
{
"hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF",
"name": "go-log",
"version": "1.5.9"
},
{
"author": "whyrusleeping",
"hash": "QmTW4SdgBWq9GjsBsHeUx8WuGxzhgzAf88UMH2w62PC8yK",
"name": "go-libp2p-crypto",
"version": "2.0.7"
},
{
"author": "whyrusleeping",
"hash": "QmYVXrKrKHDC9FobgmcmshCDyWwdrfwfanNQN4oxJ9Fk3h",
"name": "go-libp2p-peer",
"version": "3.1.2"
},
{
"author": "whyrusleeping",
"hash": "QmaCTz9RkrU13bm9kMB54f7atgqM4qkjDZpRwRoJiWXEqs",
"name": "go-libp2p-peerstore",
"version": "2.0.19"
},
{
"hash": "QmbeHtaBy9nZsW4cHRcvgVY4CnDhXudE2Dr6qDxS7yg9rX",
"name": "go-libp2p-record",
"version": "4.1.15"
},
{
"author": "whyrusleeping",
"hash": "QmddjPSGZb3ieihSseFeCfVRpZzcqczPNsD2DvarSwnjJB",
"name": "gogo-protobuf",
"version": "1.2.1"
}
],
"gxVersion": "0.12.1",
"language": "go",
"license": "MIT",
"name": "go-ipns",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "0.1.23"
}
......@@ -9,6 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -20,7 +21,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type IpnsEntry_ValidityType int32
......@@ -91,7 +92,7 @@ func (m *IpnsEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_IpnsEntry.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
......@@ -187,7 +188,7 @@ var fileDescriptor_4d5b16fb32bfe8ea = []byte{
func (m *IpnsEntry) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
......@@ -195,67 +196,79 @@ func (m *IpnsEntry) Marshal() (dAtA []byte, err error) {
}
func (m *IpnsEntry) MarshalTo(dAtA []byte) (int, error) {
var i int
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *IpnsEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Value == nil {
return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value")
} else {
dAtA[i] = 0xa
i++
i = encodeVarintIpns(dAtA, i, uint64(len(m.Value)))
i += copy(dAtA[i:], m.Value)
}
if m.Signature == nil {
return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("signature")
} else {
dAtA[i] = 0x12
i++
i = encodeVarintIpns(dAtA, i, uint64(len(m.Signature)))
i += copy(dAtA[i:], m.Signature)
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.ValidityType != nil {
dAtA[i] = 0x18
i++
i = encodeVarintIpns(dAtA, i, uint64(*m.ValidityType))
if m.PubKey != nil {
i -= len(m.PubKey)
copy(dAtA[i:], m.PubKey)
i = encodeVarintIpns(dAtA, i, uint64(len(m.PubKey)))
i--
dAtA[i] = 0x3a
}
if m.Validity != nil {
dAtA[i] = 0x22
i++
i = encodeVarintIpns(dAtA, i, uint64(len(m.Validity)))
i += copy(dAtA[i:], m.Validity)
if m.Ttl != nil {
i = encodeVarintIpns(dAtA, i, uint64(*m.Ttl))
i--
dAtA[i] = 0x30
}
if m.Sequence != nil {
dAtA[i] = 0x28
i++
i = encodeVarintIpns(dAtA, i, uint64(*m.Sequence))
i--
dAtA[i] = 0x28
}
if m.Ttl != nil {
dAtA[i] = 0x30
i++
i = encodeVarintIpns(dAtA, i, uint64(*m.Ttl))
if m.Validity != nil {
i -= len(m.Validity)
copy(dAtA[i:], m.Validity)
i = encodeVarintIpns(dAtA, i, uint64(len(m.Validity)))
i--
dAtA[i] = 0x22
}
if m.PubKey != nil {
dAtA[i] = 0x3a
i++
i = encodeVarintIpns(dAtA, i, uint64(len(m.PubKey)))
i += copy(dAtA[i:], m.PubKey)
if m.ValidityType != nil {
i = encodeVarintIpns(dAtA, i, uint64(*m.ValidityType))
i--
dAtA[i] = 0x18
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
if m.Signature == nil {
return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("signature")
} else {
i -= len(m.Signature)
copy(dAtA[i:], m.Signature)
i = encodeVarintIpns(dAtA, i, uint64(len(m.Signature)))
i--
dAtA[i] = 0x12
}
return i, nil
if m.Value == nil {
return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("value")
} else {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintIpns(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintIpns(dAtA []byte, offset int, v uint64) int {
offset -= sovIpns(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
return base
}
func (m *IpnsEntry) Size() (n int) {
if m == nil {
......@@ -295,14 +308,7 @@ func (m *IpnsEntry) Size() (n int) {
}
func sovIpns(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
return (math_bits.Len64(x|1) + 6) / 7
}
func sozIpns(x uint64) (n int) {
return sovIpns(uint64((x << 1) ^ uint64((int64(x) >> 63))))
......@@ -569,6 +575,7 @@ func (m *IpnsEntry) Unmarshal(dAtA []byte) error {
func skipIpns(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
......@@ -600,10 +607,8 @@ func skipIpns(dAtA []byte) (n int, err error) {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
......@@ -627,52 +632,27 @@ func skipIpns(dAtA []byte) (n int, err error) {
if iNdEx < 0 {
return 0, ErrInvalidLengthIpns
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowIpns
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipIpns(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
if iNdEx < 0 {
return 0, ErrInvalidLengthIpns
}
}
return iNdEx, nil
depth++
case 4:
return iNdEx, nil
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupIpns
}
depth--
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if depth == 0 {
return iNdEx, nil
}
}
panic("unreachable")
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthIpns = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowIpns = fmt.Errorf("proto: integer overflow")
ErrInvalidLengthIpns = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowIpns = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupIpns = fmt.Errorf("proto: unexpected end of group")
)
......@@ -8,9 +8,9 @@ import (
proto "github.com/gogo/protobuf/proto"
logging "github.com/ipfs/go-log"
ic "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
pstore "github.com/libp2p/go-libp2p-peerstore"
ic "github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
pstore "github.com/libp2p/go-libp2p-core/peerstore"
record "github.com/libp2p/go-libp2p-record"
)
......
......@@ -10,7 +10,7 @@ import (
proto "github.com/gogo/protobuf/proto"
u "github.com/ipfs/go-ipfs-util"
ci "github.com/libp2p/go-libp2p-crypto"
ci "github.com/libp2p/go-libp2p-core/crypto"
)
func shuffle(a []*pb.IpnsEntry) {
......@@ -51,7 +51,7 @@ func TestOrdering(t *testing.T) {
// generate a key for signing the records
r := u.NewSeededRand(15) // generate deterministic keypair
priv, _, err := ci.GenerateKeyPairWithReader(ci.RSA, 1024, r)
priv, _, err := ci.GenerateKeyPairWithReader(ci.RSA, 2048, r)
if err != nil {
t.Fatal(err)
}
......
......@@ -11,9 +11,9 @@ import (
proto "github.com/gogo/protobuf/proto"
u "github.com/ipfs/go-ipfs-util"
ci "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
pstore "github.com/libp2p/go-libp2p-peerstore"
ci "github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
pstore "github.com/libp2p/go-libp2p-core/peerstore"
pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem"
)
......@@ -162,7 +162,7 @@ func TestPeerIDPubKeyValidate(t *testing.T) {
func genKeys(t *testing.T) (ci.PrivKey, peer.ID, string) {
sr := u.NewTimeSeededRand()
priv, _, err := ci.GenerateKeyPairWithReader(ci.RSA, 1024, sr)
priv, _, err := ci.GenerateKeyPairWithReader(ci.RSA, 2048, sr)
if err != nil {
t.Fatal(err)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment