mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-23 08:33:45 +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
|
|
}
|