diff --git a/README.md b/README.md index f766b69..f125701 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,7 @@ > an implementation of the multistream protocol in go -This package implements a simple stream router for the multistream-select protocol. -The protocol is defined [here](https://github.com/multiformats/multistream-select). +This package implements a simple stream router for the [multistream-select protocol](https://github.com/multiformats/multistream-select). ## Table of Contents diff --git a/client.go b/client.go index 5ca9885..c3931fc 100644 --- a/client.go +++ b/client.go @@ -54,7 +54,7 @@ func SelectProtoOrFail[T StringLike](proto T, rwc io.ReadWriteCloser) (err error errCh := make(chan error, 1) go func() { var buf bytes.Buffer - if err := delitmWriteAll(&buf, []byte(ProtocolID), []byte(proto)); err != nil { + if err := delimWriteAll(&buf, []byte(ProtocolID), []byte(proto)); err != nil { errCh <- err return } diff --git a/multistream.go b/multistream.go index 17e1ef7..a7ea267 100644 --- a/multistream.go +++ b/multistream.go @@ -1,5 +1,5 @@ // Package multistream implements a simple stream router for the -// multistream-select protocoli. The protocol is defined at +// multistream-select protocol. The protocol is defined at // https://github.com/multiformats/multistream-select package multistream @@ -88,7 +88,7 @@ func delimWriteBuffered(w io.Writer, mes []byte) error { return bw.Flush() } -func delitmWriteAll(w io.Writer, messages ...[]byte) error { +func delimWriteAll(w io.Writer, messages ...[]byte) error { for _, mes := range messages { if err := delimWrite(w, mes); err != nil { return fmt.Errorf("failed to write messages %s, err: %v ", string(mes), err) @@ -159,7 +159,7 @@ func (msm *MultistreamMuxer[T]) removeHandler(protocol T) { } } -// Protocols returns the list of handler-names added to this this muxer. +// Protocols returns the list of handler-names added to this muxer. func (msm *MultistreamMuxer[T]) Protocols() []T { msm.handlerlock.RLock() defer msm.handlerlock.RUnlock() diff --git a/multistream_test.go b/multistream_test.go index 9828ac4..f4633a6 100644 --- a/multistream_test.go +++ b/multistream_test.go @@ -677,7 +677,7 @@ func (rob *readonlyBuffer) Close() error { return nil } -func TestNegotiatThenWriteFail(t *testing.T) { +func TestNegotiateThenWriteFail(t *testing.T) { buf := new(bytes.Buffer) err := delimWrite(buf, []byte(ProtocolID)) @@ -753,8 +753,8 @@ func TestNegotiatePeerSendsAndCloses(t *testing.T) { if err != nil { t.Fatal(err) } - delimtedProtocolID := make([]byte, buf.Len()) - copy(delimtedProtocolID, buf.Bytes()) + delimitedProtocolID := make([]byte, buf.Len()) + copy(delimitedProtocolID, buf.Bytes()) err = delimWrite(&buf, []byte("foo")) if err != nil { @@ -777,7 +777,7 @@ func TestNegotiatePeerSendsAndCloses(t *testing.T) { // We mock the closed stream by only expecting a single write. The // mockstream will error on any more writes (same as writing to a closed // stream) - expectWrite: [][]byte{delimtedProtocolID}, + expectWrite: [][]byte{delimitedProtocolID}, toRead: [][]byte{buf.Bytes()}, }, },