mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-12 18:00:49 +01:00
23 lines
346 B
Go
23 lines
346 B
Go
package wgproxy
|
|
|
|
import "context"
|
|
|
|
type Factory struct {
|
|
wgPort int
|
|
ebpfProxy Proxy
|
|
}
|
|
|
|
func (w *Factory) GetProxy(ctx context.Context) Proxy {
|
|
if w.ebpfProxy != nil {
|
|
return w.ebpfProxy
|
|
}
|
|
return NewWGUserSpaceProxy(ctx, w.wgPort)
|
|
}
|
|
|
|
func (w *Factory) Free() error {
|
|
if w.ebpfProxy != nil {
|
|
return w.ebpfProxy.Free()
|
|
}
|
|
return nil
|
|
}
|