本文整理汇总了Golang中github.com/coreos/fleet/ssh.NewHostKeyFile函数的典型用法代码示例。如果您正苦于以下问题:Golang NewHostKeyFile函数的具体用法?Golang NewHostKeyFile怎么用?Golang NewHostKeyFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewHostKeyFile函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getChecker
func getChecker() *ssh.HostKeyChecker {
if !Flags.StrictHostKeyChecking {
return nil
}
keyFile := ssh.NewHostKeyFile(Flags.KnownHostsFile)
return ssh.NewHostKeyChecker(keyFile)
}
示例2: getChecker
// getChecker creates and returns a HostKeyChecker, or nil if any error is encountered
func getChecker() *ssh.HostKeyChecker {
if !globalFlags.StrictHostKeyChecking {
return nil
}
keyFile := ssh.NewHostKeyFile(globalFlags.KnownHostsFile)
return ssh.NewHostKeyChecker(keyFile, askToTrustHost, nil)
}
示例3: getChecker
// getChecker creates and returns a HostKeyChecker, or nil if any error is encountered
func getChecker(config FleetConfig) *ssh.HostKeyChecker {
if !config.StrictHostKeyChecking {
return nil
}
keyFile := ssh.NewHostKeyFile(config.KnownHostsFile)
return ssh.NewHostKeyChecker(keyFile)
}
示例4: getChecker
func getChecker() *ssh.HostKeyChecker {
if !(*flagset.Lookup("strict-host-key-checking")).Value.(flag.Getter).Get().(bool) {
return nil
}
knownHostsFile := (*flagset.Lookup("known-hosts-file")).Value.(flag.Getter).Get().(string)
keyFile := ssh.NewHostKeyFile(knownHostsFile)
return ssh.NewHostKeyChecker(keyFile, askToTrustHost, nil)
}
示例5: getChecker
// getChecker creates and returns a HostKeyChecker, or nil if any error is encountered
func getChecker(cCmd *cobra.Command) *ssh.HostKeyChecker {
strictHostKeyChecking, _ := cmdFleet.PersistentFlags().GetBool("strict-host-key-checking")
if !strictHostKeyChecking {
return nil
}
knownHostsFile, _ := cmdFleet.PersistentFlags().GetString("known-hosts-file")
keyFile := ssh.NewHostKeyFile(knownHostsFile)
return ssh.NewHostKeyChecker(keyFile)
}