zrepl/daemon/connecter/connecter.go
Christian Schwarz c69ebd3806 WIP rewrite the daemon
cmd subdir does not build on purpose, it's only left in tree to grab old
code and move it to github.com/zrepl/zrepl/daemon
2018-08-27 22:22:44 +02:00

21 lines
518 B
Go

package connecter
import (
"fmt"
"github.com/problame/go-streamrpc"
"github.com/zrepl/zrepl/config"
)
func FromConfig(g config.Global, in config.ConnectEnum) (streamrpc.Connecter, error) {
switch v := in.Ret.(type) {
case *config.SSHStdinserverConnect:
return SSHStdinserverConnecterFromConfig(v)
case *config.TCPConnect:
return TCPConnecterFromConfig(v)
case *config.TLSConnect:
return TLSConnecterFromConfig(v)
default:
panic(fmt.Sprintf("implementation error: unknown connecter type %T", v))
}
}