25 lines
695 B
Go
25 lines
695 B
Go
|
package driver
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/Neur0toxine/sshpoke/internal/config"
|
||
|
"github.com/Neur0toxine/sshpoke/internal/server/driver/iface"
|
||
|
"github.com/Neur0toxine/sshpoke/internal/server/driver/null"
|
||
|
"github.com/Neur0toxine/sshpoke/internal/server/driver/plugin"
|
||
|
"github.com/Neur0toxine/sshpoke/internal/server/driver/ssh"
|
||
|
)
|
||
|
|
||
|
func New(ctx context.Context, name string, driver config.DriverType, params config.DriverParams) (iface.Driver, error) {
|
||
|
switch driver {
|
||
|
case config.DriverSSH:
|
||
|
return ssh.New(ctx, name, params)
|
||
|
case config.DriverPlugin:
|
||
|
return plugin.New(ctx, name, params)
|
||
|
case config.DriverNull:
|
||
|
fallthrough
|
||
|
default:
|
||
|
return null.New(ctx, name, params)
|
||
|
}
|
||
|
}
|