mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-10-15 20:52:16 +08:00
chore: fix typos (#2689)
This commit is contained in:
@@ -25,7 +25,7 @@ func TestECDSABasicSignAndVerify(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("signature didnt match")
|
t.Fatal("signature didn't match")
|
||||||
}
|
}
|
||||||
|
|
||||||
// change data
|
// change data
|
||||||
|
@@ -24,7 +24,7 @@ func TestRSABasicSignAndVerify(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("signature didnt match")
|
t.Fatal("signature didn't match")
|
||||||
}
|
}
|
||||||
|
|
||||||
// change data
|
// change data
|
||||||
|
@@ -24,7 +24,7 @@ func TestSecp256k1BasicSignAndVerify(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatal("signature didnt match")
|
t.Fatal("signature didn't match")
|
||||||
}
|
}
|
||||||
|
|
||||||
// change data
|
// change data
|
||||||
|
@@ -76,7 +76,7 @@ type Routing interface {
|
|||||||
ValueStore
|
ValueStore
|
||||||
|
|
||||||
// Bootstrap allows callers to hint to the routing system to get into a
|
// Bootstrap allows callers to hint to the routing system to get into a
|
||||||
// Boostrapped state and remain there. It is not a synchronous call.
|
// Bootstrapped state and remain there. It is not a synchronous call.
|
||||||
Bootstrap(context.Context) error
|
Bootstrap(context.Context) error
|
||||||
|
|
||||||
// TODO expose io.Closer or plain-old Close error
|
// TODO expose io.Closer or plain-old Close error
|
||||||
|
@@ -110,7 +110,7 @@ func (m *MessageData) GetSign() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// a protocol define a set of reuqest and responses
|
// A protocol defines a set of requests and responses.
|
||||||
type PingRequest struct {
|
type PingRequest struct {
|
||||||
MessageData *MessageData `protobuf:"bytes,1,opt,name=messageData" json:"messageData,omitempty"`
|
MessageData *MessageData `protobuf:"bytes,1,opt,name=messageData" json:"messageData,omitempty"`
|
||||||
// method specific data
|
// method specific data
|
||||||
@@ -205,7 +205,7 @@ func (m *PingResponse) GetMessage() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// a protocol define a set of reuqest and responses
|
// A protocol defines a set of requests and responses
|
||||||
type EchoRequest struct {
|
type EchoRequest struct {
|
||||||
MessageData *MessageData `protobuf:"bytes,1,opt,name=messageData" json:"messageData,omitempty"`
|
MessageData *MessageData `protobuf:"bytes,1,opt,name=messageData" json:"messageData,omitempty"`
|
||||||
// method specific data
|
// method specific data
|
||||||
|
@@ -16,7 +16,7 @@ message MessageData {
|
|||||||
|
|
||||||
//// ping protocol
|
//// ping protocol
|
||||||
|
|
||||||
// a protocol define a set of reuqest and responses
|
// A protocol defines a set of requests and responses.
|
||||||
message PingRequest {
|
message PingRequest {
|
||||||
MessageData messageData = 1;
|
MessageData messageData = 1;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ message PingResponse {
|
|||||||
|
|
||||||
//// echo protocol
|
//// echo protocol
|
||||||
|
|
||||||
// a protocol define a set of reuqest and responses
|
// A protocol defines a set of requests and responses.
|
||||||
message EchoRequest {
|
message EchoRequest {
|
||||||
MessageData messageData = 1;
|
MessageData messageData = 1;
|
||||||
|
|
||||||
|
@@ -189,7 +189,7 @@ func TestAutoNATServiceRateLimitJitter(t *testing.T) {
|
|||||||
svc.mx.Lock()
|
svc.mx.Lock()
|
||||||
defer svc.mx.Unlock()
|
defer svc.mx.Unlock()
|
||||||
return svc.globalReqs == 0
|
return svc.globalReqs == 0
|
||||||
}, dur*5/2, 10*time.Millisecond, "reset of rate limitter occurred slower than expected")
|
}, dur*5/2, 10*time.Millisecond, "reset of rate limiter occurred slower than expected")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAutoNATServiceStartup(t *testing.T) {
|
func TestAutoNATServiceStartup(t *testing.T) {
|
||||||
|
@@ -59,7 +59,7 @@ var (
|
|||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
Namespace: metricNamespace,
|
Namespace: metricNamespace,
|
||||||
Name: "candidates_circuit_v2_support_total",
|
Name: "candidates_circuit_v2_support_total",
|
||||||
Help: "Candidiates supporting circuit v2",
|
Help: "Candidates supporting circuit v2",
|
||||||
},
|
},
|
||||||
[]string{"support"},
|
[]string{"support"},
|
||||||
)
|
)
|
||||||
@@ -167,7 +167,7 @@ func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer {
|
|||||||
metricshelper.RegisterCollectors(setting.reg, collectors...)
|
metricshelper.RegisterCollectors(setting.reg, collectors...)
|
||||||
|
|
||||||
// Initialise these counters to 0 otherwise the first reservation requests aren't handled
|
// Initialise these counters to 0 otherwise the first reservation requests aren't handled
|
||||||
// correctly when using promql increse function
|
// correctly when using promql increase function
|
||||||
reservationRequestsOutcomeTotal.WithLabelValues("refresh", "success")
|
reservationRequestsOutcomeTotal.WithLabelValues("refresh", "success")
|
||||||
reservationRequestsOutcomeTotal.WithLabelValues("new", "success")
|
reservationRequestsOutcomeTotal.WithLabelValues("new", "success")
|
||||||
candidatesCircuitV2SupportTotal.WithLabelValues("yes")
|
candidatesCircuitV2SupportTotal.WithLabelValues("yes")
|
||||||
|
@@ -63,7 +63,7 @@ type relayFinder struct {
|
|||||||
candidates map[peer.ID]*candidate
|
candidates map[peer.ID]*candidate
|
||||||
backoff map[peer.ID]time.Time
|
backoff map[peer.ID]time.Time
|
||||||
maybeConnectToRelayTrigger chan struct{} // cap: 1
|
maybeConnectToRelayTrigger chan struct{} // cap: 1
|
||||||
// Any time _something_ hapens that might cause us to need new candidates.
|
// Any time _something_ happens that might cause us to need new candidates.
|
||||||
// This could be
|
// This could be
|
||||||
// * the disconnection of a relay
|
// * the disconnection of a relay
|
||||||
// * the failed attempt to obtain a reservation with a current candidate
|
// * the failed attempt to obtain a reservation with a current candidate
|
||||||
|
@@ -127,7 +127,7 @@ func (nmgr *natManager) background(ctx context.Context) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-nmgr.syncFlag:
|
case <-nmgr.syncFlag:
|
||||||
nmgr.doSync() // sync when our listen addresses chnage.
|
nmgr.doSync() // sync when our listen addresses change.
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -113,7 +113,7 @@ func (t *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p pee
|
|||||||
for _, muxer := range t.muxers {
|
for _, muxer := range t.muxers {
|
||||||
muxers = append(muxers, (string)(muxer))
|
muxers = append(muxers, (string)(muxer))
|
||||||
}
|
}
|
||||||
// Prepend the prefered muxers list to TLS config.
|
// Prepend the preferred muxers list to TLS config.
|
||||||
config.NextProtos = append(muxers, config.NextProtos...)
|
config.NextProtos = append(muxers, config.NextProtos...)
|
||||||
cs, err := t.handshake(ctx, tls.Client(insecure, config), keyCh)
|
cs, err := t.handshake(ctx, tls.Client(insecure, config), keyCh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -79,7 +79,7 @@ func benchmarkHandshakes(b *testing.B, factory Factory) {
|
|||||||
|
|
||||||
pipes := make(chan net.Conn, 1)
|
pipes := make(chan net.Conn, 1)
|
||||||
|
|
||||||
var finished sync.Mutex // wait until all data has been transfered
|
var finished sync.Mutex // wait until all data has been transferred
|
||||||
finished.Lock()
|
finished.Lock()
|
||||||
go func() {
|
go func() {
|
||||||
defer finished.Unlock()
|
defer finished.Unlock()
|
||||||
|
Reference in New Issue
Block a user