本文整理汇总了Golang中camlistore/org/pkg/client.Client.InsecureTLS方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.InsecureTLS方法的具体用法?Golang Client.InsecureTLS怎么用?Golang Client.InsecureTLS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类camlistore/org/pkg/client.Client
的用法示例。
在下文中一共展示了Client.InsecureTLS方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: discoClient
// discoClient returns a client initialized with a server
// based from the configuration file. The returned client
// can then be used to discover the blobRoot and syncHandlers.
func (c *indexCmd) discoClient() *client.Client {
var cl *client.Client
cl = client.NewOrFail()
cl.InsecureTLS = c.insecureTLS
cl.SetHTTPClient(&http.Client{
Transport: cl.TransportForConfig(nil),
})
cl.SetupAuth()
return cl
}
示例2: discoClient
// discoClient returns a client initialized with a server
// based from --src or from the configuration file if --src
// is blank. The returned client can then be used to discover
// the blobRoot and syncHandlers.
func (c *syncCmd) discoClient() *client.Client {
var cl *client.Client
if c.src == "" {
cl = client.NewOrFail()
} else {
cl = client.New(c.src)
}
cl.SetLogger(c.logger)
cl.InsecureTLS = c.insecureTLS
cl.SetHTTPClient(&http.Client{
Transport: cl.TransportForConfig(nil),
})
cl.SetupAuth()
return cl
}
示例3: main
func main() {
client.AddFlags()
flag.Parse()
if *flagVersion {
fmt.Fprintf(os.Stderr, "camget version: %s\n", buildinfo.Version())
return
}
if *flagGraph && flag.NArg() != 1 {
log.Fatalf("The --graph option requires exactly one parameter.")
}
var cl *client.Client
var items []*blobref.BlobRef
if *flagShared != "" {
if client.ExplicitServer() != "" {
log.Fatal("Can't use --shared with an explicit blobserver; blobserver is implicit from the --shared URL.")
}
if flag.NArg() != 0 {
log.Fatal("No arguments permitted when using --shared")
}
cl1, target, err := client.NewFromShareRoot(*flagShared,
client.OptionInsecure(*flagInsecureTLS))
if err != nil {
log.Fatal(err)
}
cl = cl1
items = append(items, target)
} else {
cl = client.NewOrFail()
for n := 0; n < flag.NArg(); n++ {
arg := flag.Arg(n)
br := blobref.Parse(arg)
if br == nil {
log.Fatalf("Failed to parse argument %q as a blobref.", arg)
}
items = append(items, br)
}
}
cl.InsecureTLS = *flagInsecureTLS
tr := cl.TransportForConfig(&client.TransportConfig{
Verbose: *flagHTTP,
})
httpStats, _ := tr.(*httputil.StatsTransport)
cl.SetHTTPClient(&http.Client{Transport: tr})
diskCacheFetcher, err := cacher.NewDiskCache(cl)
if err != nil {
log.Fatalf("Error setting up local disk cache: %v", err)
}
defer diskCacheFetcher.Clean()
if *flagVerbose {
log.Printf("Using temp blob cache directory %s", diskCacheFetcher.Root)
}
for _, br := range items {
if *flagGraph {
printGraph(diskCacheFetcher, br)
return
}
if *flagCheck {
// TODO: do HEAD requests checking if the blobs exists.
log.Fatal("not implemented")
return
}
if *flagOutput == "-" {
var rc io.ReadCloser
var err error
if *flagContents {
rc, err = schema.NewFileReader(diskCacheFetcher, br)
if err == nil {
rc.(*schema.FileReader).LoadAllChunks()
}
} else {
rc, err = fetch(diskCacheFetcher, br)
}
if err != nil {
log.Fatal(err)
}
defer rc.Close()
if _, err := io.Copy(os.Stdout, rc); err != nil {
log.Fatalf("Failed reading %q: %v", br, err)
}
} else {
if err := smartFetch(diskCacheFetcher, *flagOutput, br); err != nil {
log.Fatal(err)
}
}
}
if *flagVerbose {
log.Printf("HTTP requests: %d\n", httpStats.Requests())
}
}