Skip to content

Instantly share code, notes, and snippets.

@martinthomson
martinthomson / pn_test.go
Last active August 2, 2018 06:36
Test of different packet number recovery options
package minq_test
import "testing"
func recoverMinq(expected uint64, pn uint64, size int) uint64 {
// Mask off the top of the expected sequence number
mask := uint64(1)
mask = (mask << (uint8(size) * 8)) - 1
expectedLow := mask & expected
high := ^mask & expected

Keybase proof

I hereby claim:

  • I am martinthomson on github.
  • I am martinthomson (https://keybase.io/martinthomson) on keybase.
  • I have a public key ASDuem6wah9reI_8gyoUXVgD_mzE5F_JqofPsxvhEKvHFwo

To claim this, I am signing this object:

@martinthomson
martinthomson / minq_test.go
Created February 26, 2018 09:11
Compare minq and golang TCP IO discipline
package minhq_test
import (
"io"
"net"
"testing"
"github.com/ekr/minq"
"github.com/stvp/assert"
)
absoluteURI = /[A-Za-z](?:[\+\-\.]|[A-Za-z]|\d)*:(?:\/\/(?:(?::|(?:[\-\._~]|[A-Za-z]|\d)|%(?:(?:[A-Fa-f]|\d)){2}|[!$&'\(\)\*\+,;=])*@)?(?:\[(?:(?:(?:(?:(?:[A-Fa-f]|\d)){1,4}:){6}(?:(?:(?:[A-Fa-f]|\d)){1,4}:(?:(?:[A-Fa-f]|\d)){1,4}|(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5]))|::(?:(?:(?:[A-Fa-f]|\d)){1,4}:){5}(?:(?:(?:[A-Fa-f]|\d)){1,4}:(?:(?:[A-Fa-f]|\d)){1,4}|(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5]))|(?:(?:(?:[A-Fa-f]|\d)){1,4})?::(?:(?:(?:[A-Fa-f]|\d)){1,4}:){4}(?:(?:(?:[A-Fa-f]|\d)){1,4}:(?:(?:[A-Fa-f]|\d)){1,4}|(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5])\.(?:\d|[1-9]\d|1(?:\d){2}|2[0-4]\d|25[0-5]))|(?:(?:(?:(?:[A-Fa-f]|\d)){1,4}:)?(?:(?:[A-Fa-f]|\d)){1,4})?::(