diff --git a/client/embed/embed.go b/client/embed/embed.go index ae57d6666..ba7bcf1ce 100644 --- a/client/embed/embed.go +++ b/client/embed/embed.go @@ -180,13 +180,6 @@ func New(opts Options) (*Client, error) { } } - if opts.Performance.PreallocatedBuffersPerPool != nil { - wgdevice.SetPreallocatedBuffersPerPool(*opts.Performance.PreallocatedBuffersPerPool) - } - if opts.Performance.MaxBatchSize != nil { - wgdevice.SetMaxBatchSizeOverride(*opts.Performance.MaxBatchSize) - } - var err error var parsedLabels domain.List if parsedLabels, err = domain.FromStringList(opts.DNSLabels); err != nil { @@ -220,6 +213,13 @@ func New(opts Options) (*Client, error) { config.PrivateKey = opts.PrivateKey } + if opts.Performance.PreallocatedBuffersPerPool != nil { + wgdevice.SetPreallocatedBuffersPerPool(*opts.Performance.PreallocatedBuffersPerPool) + } + if opts.Performance.MaxBatchSize != nil { + wgdevice.SetMaxBatchSizeOverride(*opts.Performance.MaxBatchSize) + } + return &Client{ deviceName: opts.DeviceName, setupKey: opts.SetupKey,