func (s *sshd) init(pod *Pod, config interface{}) error {
	if pod == nil {
		return errNeedPod
	}
	if config == nil {
		return fmt.Errorf("config cannot be empty")
	}
	c := config.(SshdConfig)
	if c.validate() == false {
		return fmt.Errorf("Invalid configuration")
	}
	s.config = c
	s.spawner = newSpawner(c.Spawner)
	return nil
}
init is the agent initialization implementation for sshd.
package virtcontainers
import (
	"fmt"
	"io/ioutil"
	"strings"
	"syscall"
	"time"
	"golang.org/x/crypto/ssh"
)
type SshdConfig struct {
	Username    string
	PrivKeyFile string
	Server      string
	Port        string
	Protocol    string
	Spawner SpawnerType
}
type sshd struct {
	config SshdConfig
	client *ssh.Client
	spawner spawner
}
func (c SshdConfig) validate() bool {
	return true
}
func publicKeyAuth(file string) (ssh.AuthMethod, error) {
	if file == "" {
		return nil, errNeedFile
	}
	privateBytes, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, fmt.Errorf("Failed to load private key")
	}
	private, err := ssh.ParsePrivateKey(privateBytes)
	if err != nil {
		return nil, fmt.Errorf("Failed to parse private key")
	}
	return ssh.PublicKeys(private), nil
}
func execCmd(session *ssh.Session, cmd string) error {
	if session == nil {
		return fmt.Errorf("session cannot be empty")
	}
	stdout, err := session.CombinedOutput(cmd)
	if err != nil {
		return fmt.Errorf("Failed to run %s", cmd)
	}
	fmt.Printf("%s\n", stdout)
	return nil
}