Skip to content

Commit

Permalink
add doc.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ainghazal committed Jan 29, 2024
1 parent 5b4d2eb commit 8c5816c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions internal/reliabletransport/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Package reliabletransport implements the reliable transport.
// A note about terminology: in this package, "receiver" is the moveUpWorker in the [reliabletransport.Service] (since it receives incoming packets), and
// "sender" is the moveDownWorker in the same service. The corresponding data structures lack mutexes because they are intended to be confined to a single
// goroutine (one for each worker), and they SHOULD ONLY communicate via message passing.
package reliabletransport
7 changes: 3 additions & 4 deletions internal/reliabletransport/packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import (
"github.com/ooni/minivpn/internal/optional"
)

//
// A note about terminology: in the following, **receiver** is the moveUpWorker in the [reliabletransport.Service] (since it receives incoming packets), and **sender** is the moveDownWorker in the same service. The following data structures lack mutexes because they are intended to be confined to a single goroutine (one for each worker), and they only communicate via message passing.
//

// inFlighPacket is an implementation of inFlighter. It is a sequential packet
// that can be scheduled for retransmission.
type inFlightPacket struct {
// deadline is a moment in time when is this packet scheduled for the next retransmission.
deadline time.Time
Expand Down Expand Up @@ -59,6 +57,7 @@ func (p *inFlightPacket) backoff() time.Duration {
return backoff
}

// TODO: revisit interfaces while writing tests.
// assert that inFlightWrappedPacket implements inFlightPacket and sequentialPacket
// var _ inFlightPacket = &inFlightWrappedPacket{}
// var _ sequentialPacket = &inFlightWrappedPacket{}
Expand Down

0 comments on commit 8c5816c

Please sign in to comment.