Skip to content
This repository was archived by the owner on Dec 7, 2019. It is now read-only.

Commit 290882d

Browse files
committed
alias deprecated funcs by proxying calls.
1 parent 5f70c21 commit 290882d

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module github.com/libp2p/go-conn-security
22

33
require (
4-
github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8
4+
github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b
55
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 // indirect
66
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e // indirect
77
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6
3131
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
3232
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
3333
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
34-
github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8 h1:JhVz9FMZJ2iUZ0O2rxgfpgf6Pbf4ngi+gpkjT9hi/R8=
35-
github.com/libp2p/go-libp2p-core v0.0.0-20190417121120-c9a30b9fbea8/go.mod h1:4iqSipG3tx8vB0FVHHRPVl6/lZqPht2Lhd/ZBlIGNSo=
34+
github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b h1:G7jk8dtQP5NeK5uckxMarWHNH0bTTDpSUMPUQwGtFEU=
35+
github.com/libp2p/go-libp2p-core v0.0.0-20190417162149-f41b5dd7c01b/go.mod h1:4iqSipG3tx8vB0FVHHRPVl6/lZqPht2Lhd/ZBlIGNSo=
3636
github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw=
3737
github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE=
3838
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g=

insecure/deprecated.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package insecure
22

3-
import moved "github.com/libp2p/go-libp2p-core/sec/insecure"
3+
import (
4+
"github.com/libp2p/go-libp2p-core/peer"
5+
moved "github.com/libp2p/go-libp2p-core/sec/insecure"
6+
)
47

58
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/insecure.ID instead.
69
const ID = moved.ID
@@ -9,7 +12,9 @@ const ID = moved.ID
912
type Transport = moved.Transport
1013

1114
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/insecure.New instead.
12-
var New = moved.New
15+
func New(id peer.ID) *moved.Transport {
16+
return moved.New(id)
17+
}
1318

1419
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/insecure.Conn instead.
1520
type Conn = moved.Conn

test/deprecated.go

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package ss_test
22

3-
import moved "github.com/libp2p/go-libp2p-core/sec/test"
3+
import (
4+
"testing"
5+
6+
"github.com/libp2p/go-libp2p-core/peer"
7+
"github.com/libp2p/go-libp2p-core/sec"
8+
9+
moved "github.com/libp2p/go-libp2p-core/sec/test"
10+
)
411

512
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.Subtests instead.
613
var Subtests = moved.Subtests
@@ -9,25 +16,41 @@ var Subtests = moved.Subtests
916
var TestMessage = moved.TestMessage
1017

1118
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.TestStreamLen instead.
19+
// Warning: it's impossible to alias a var in go, so reads and writes to this variable may be inaccurate
20+
// or not have the intended effect.
1221
var TestStreamLen = moved.TestStreamLen
1322

1423
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.TestSeed instead.
24+
// Warning: it's impossible to alias a var in go, so reads and writes to this variable may be inaccurate
25+
// or not have the intended effect.
1526
var TestSeed = moved.TestSeed
1627

1728
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.SubtestAll instead.
18-
var SubtestAll = moved.SubtestAll
29+
func SubtestAll(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {
30+
moved.SubtestAll(t, at, bt, ap, bp)
31+
}
1932

2033
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.SubtestKeys instead.
21-
var SubtestKeys = moved.SubtestKeys
34+
func SubtestKeys(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {
35+
moved.SubtestKeys(t, at, bt, ap, bp)
36+
}
2237

2338
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.SubtestWrongPeer instead.
24-
var SubtestWrongPeer = moved.SubtestWrongPeer
39+
func SubtestWrongPeer(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {
40+
moved.SubtestWrongPeer(t, at, bt, ap, bp)
41+
}
2542

2643
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.SubtestCancelHandshakeOutbound instead.
27-
var SubtestCancelHandshakeOutbound = moved.SubtestCancelHandshakeOutbound
44+
func SubtestCancelHandshakeOutbound(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {
45+
moved.SubtestCancelHandshakeOutbound(t, at, bt, ap, bp)
46+
}
2847

2948
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.SubtestCancelHandshakeInbound instead.
30-
var SubtestCancelHandshakeInbound = moved.SubtestCancelHandshakeInbound
49+
func SubtestCancelHandshakeInbound(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {
50+
moved.SubtestCancelHandshakeInbound(t, at, bt, ap, bp)
51+
}
3152

3253
// Deprecated: Use github.com/libp2p/go-libp2p-core/sec/test.SubtestStream instead.
33-
var SubtestStream = moved.SubtestStream
54+
func SubtestStream(t *testing.T, at, bt sec.SecureTransport, ap, bp peer.ID) {
55+
moved.SubtestStream(t, at, bt, ap, bp)
56+
}

0 commit comments

Comments
 (0)