This repo contains auto-generated interfaces and wrappers for the quic-go data structures.
See c2FmZQ/tlsproxy#211 for context and motivation.
Using interfaces in this context provides a few key benefits:
-
Decoupling from a Third-Party Library: This repository helps decouple projects from the
quic-go
library. By depending on the stable interfaces inquic-api
instead of the concrete types fromquic-go
, downstream projects can be insulated from breaking API changes in the underlying library. -
Enabling Testability: The generated interfaces allow for the creation of mock implementations of the
quic-go
data structures for unit testing. This allows for testing business logic without needing a live QUIC connection. -
Following Go Idioms: This approach allows consuming projects to follow the Go proverb: "Accept interfaces, return structs." Code can accept an interface from this library, rather than a concrete type from
quic-go
.
While a library provider would ideally provide stable interfaces, this repository offers a practical alternative when they are not available.