本文整理汇总了Golang中github.com/jlmucb/cloudproxy/go/tao.Keys.TLSClientConfig方法的典型用法代码示例。如果您正苦于以下问题:Golang Keys.TLSClientConfig方法的具体用法?Golang Keys.TLSClientConfig怎么用?Golang Keys.TLSClientConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jlmucb/cloudproxy/go/tao.Keys
的用法示例。
在下文中一共展示了Keys.TLSClientConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: doRequest
func doRequest(guard tao.Guard, domain *tao.Domain, keys *tao.Keys) bool {
fmt.Printf("client: connecting to %s using %s authentication.\n", serverAddr, *demoAuth)
var conn net.Conn
var err error
network := "tcp"
switch *demoAuth {
case "tcp":
conn, err = net.Dial(network, serverAddr)
case "tls":
conf, err := keys.TLSClientConfig(nil)
options.FailIf(err, "client: couldn't encode TLS keys")
conn, err = tls.Dial(network, serverAddr, conf)
case "tao":
conn, err = tao.Dial(network, serverAddr, guard, domain.Keys.VerifyingKey, keys, nil)
}
if err != nil {
fmt.Fprintf(os.Stderr, "client: error connecting to %s: %s\n", serverAddr, err.Error())
return false
}
defer conn.Close()
_, err = fmt.Fprintf(conn, "Hello\n")
if err != nil {
fmt.Fprintf(os.Stderr, "client: can't write: %s\n", err.Error())
return false
}
msg, err := bufio.NewReader(conn).ReadString('\n')
if err != nil {
fmt.Fprintf(os.Stderr, "client: can't read: %s\n", err.Error())
return false
}
msg = strings.TrimSpace(msg)
fmt.Printf("client: got reply: %s\n", msg)
return true
}