Skip to content

Instantly share code, notes, and snippets.

@marten-seemann
Created September 22, 2017 11:04
Show Gist options
  • Save marten-seemann/629255dea89f99d1f64c0ee17f7340d6 to your computer and use it in GitHub Desktop.
Save marten-seemann/629255dea89f99d1f64c0ee17f7340d6 to your computer and use it in GitHub Desktop.
package main
import (
"math/rand"
"time"
proxy "github.com/lucas-clemente/quic-go/integrationtests/tools/proxy"
"github.com/lucas-clemente/quic-go/internal/protocol"
)
func main() {
rand.Seed(time.Now().UnixNano())
_, err := proxy.NewQuicProxy("localhost:10001", protocol.Version39, &proxy.Opts{
RemoteAddr: "localhost:6121",
DelayPacket: func(_ proxy.Direction, _ uint64) time.Duration {
return 10 * time.Millisecond
},
DropPacket: func(d proxy.Direction, p uint64) bool {
return rand.Int63()%100 == 0
},
})
if err != nil {
panic(err)
}
select {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment