Skip to content

v0.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 15 Dec 02:15

⚠️ Breaking Changes

Factory Signature Changed:

  • Old: func() (net.Conn, error)
  • New: func(context.Context) (net.Conn, error)
  • Why: Allows proper context propagation (timeout/cancellation) and removes internal goroutine overhead.

📦 Migration Guide

// BEFORE
pool, _ := netpool.New(func() (net.Conn, error) {
    return net.Dial("tcp", "addr")
}, netpool.WithMaxPool(10))

// AFTER
pool, _ := netpool.New(func(ctx context.Context) (net.Conn, error) {
    var d net.Dialer
    return d.DialContext(ctx, "tcp", "addr")
}, netpool.Config{
    MaxPool: 10,
})