Improve doc comments

This commit is contained in:
2025-01-19 17:09:20 -05:00
parent 585c8038d3
commit 02dbcacd28
2 changed files with 17 additions and 15 deletions

12
dial.go
View File

@@ -5,23 +5,19 @@ import "context"
import "crypto/tls"
import "github.com/quic-go/quic-go"
// TODO: dial should be super simple like it is now, and there should be a
// "dialer" which the dial function dial configures automaticaly, but the dialer
// should offer much more options when used directlym
// Dial opens a connection to a server. The network must be one of "udp",
// "udp4", "udp6", or "unixgram".
// Dial opens a connection to a server. The network must be one of "quic",
// "quic4", (IPv4-only) "quic6" (IPv6-only), or "unix".
func Dial(ctx context.Context, network, address string) (Conn, error) {
return (Dialer { }).Dial(ctx, network, address)
}
// TODO: export when there are options here
// Dialer allows for further configuration of the dialing process.
type Dialer struct {
TLSConfig *tls.Config
}
// Dial opens a connection to a server. The network must be one of "quic",
// "quic4", "quic6", or "unix".
// "quic4", (IPv4-only) "quic6" (IPv6-only), or "unix".
func (diale Dialer) Dial(ctx context.Context, network, address string) (Conn, error) {
switch network {
case "quic", "quic4", "quic6": return diale.dialQUIC(ctx, network, address)