1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
package backends
import (
"context"
"crypto/tls"
"sync"
"github.com/ansible/receptor/pkg/netceptor"
)
type NullBackendCfg struct {
Local bool
}
// make the nullBackendCfg object be usable as a do-nothing Backend.
func (cfg NullBackendCfg) Start(_ context.Context, _ *sync.WaitGroup) (chan netceptor.BackendSession, error) {
return make(chan netceptor.BackendSession), nil
}
// Run runs the action, in this case adding a null backend to keep the wait group alive.
func (cfg NullBackendCfg) Run() error {
err := netceptor.MainInstance.AddBackend(&NullBackendCfg{})
if err != nil {
return err
}
return nil
}
func (cfg *NullBackendCfg) GetAddr() string {
return ""
}
func (cfg *NullBackendCfg) GetTLS() *tls.Config {
return nil
}
func (cfg NullBackendCfg) Reload() error {
return cfg.Run()
}
|