Skip to content

v0.2.0

Choose a tag to compare

@connorkuehl connorkuehl released this 21 Feb 01:07
· 45 commits to main since this release

What's Changed

go-nbd, now with TLS!

The previous release was mistaken in suggesting that callers could dial over TLS by supplying an nbds-based URI and a tls.Config to the nbd.Dialer. That field has been deprecated.

Funnily enough, this does constitute a breaking behavioral change in that code that previously tried to use TLS with the nbd.Dialer will no longer vacuously fail 100% of the time during the handshake.

TLS Tutorial

As usual, put together an NBD URI and dial it with the nbd.Dialer:

uri := nbd.MustURI("nbds+unix://?socket=/var/run/test-nbd.sock")
var dialer nbd.Dialer
conn, err := dialer.Dial(context.TODO(), uri)
if err != nil {
    return fmt.Errorf("nbd dial: %w", err)
}
defer conn.Close()

Do the usual handshake to begin options negotiation:

err = conn.Connect()
if err != nil {
    return fmt.Errorf("nbd connect: %w", err)
}
defer conn.Abort()

Finally, upgrade to TLS before negotiating any other options:

err = conn.StartTLS(tlsConf)
if err != nil {
	return fmt.Errorf("start tls: %w", err)
}

That's it!

Full Changelog: v0.1.0...v0.2.0