arpc extension
API Examples
QUIC Listen, Accept, Read
import "github.com/lesismal/arpcext/quic"
ln, err := quic.Listen(":8888", somTLSConfig)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
defer ln.Close()
conn, err := ln.Accept()
buf := make([]byte, 1024)
nread, err := conn.Read(buf)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
log.Println(string(buf[:nread]))
QUIC Dial, Write
import "github.com/lesismal/arpcext/quic"
tlsConf := &tls.Config{
InsecureSkipVerify: true,
NextProtos: []string{"quic-echo-example"},
}
conn, err := quic.Dial(addr, tlsConf, nil, 0)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
defer conn.Close()
_, err := conn.Write([]byte("hello"))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}