2018-08-27 22:21:45 +02:00
|
|
|
package connecter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/problame/go-streamrpc"
|
|
|
|
"github.com/zrepl/zrepl/config"
|
|
|
|
)
|
|
|
|
|
2018-08-31 21:50:59 +02:00
|
|
|
func FromConfig(g *config.Global, in config.ConnectEnum) (streamrpc.Connecter, error) {
|
2018-08-27 22:21:45 +02:00
|
|
|
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))
|
|
|
|
}
|
|
|
|
}
|