本文整理汇总了Golang中camlistore/org/pkg/client.Client.SetupAuth方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.SetupAuth方法的具体用法?Golang Client.SetupAuth怎么用?Golang Client.SetupAuth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类camlistore/org/pkg/client.Client
的用法示例。
在下文中一共展示了Client.SetupAuth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RunCommand
func (c *syncCmd) RunCommand(args []string) error {
if c.loop && !c.removeSrc {
return cmdmain.UsageError("Can't use --loop without --removesrc")
}
if c.verbose {
c.logger = log.New(os.Stderr, "", 0) // else nil
}
if c.all {
err := c.syncAll()
if err != nil {
return fmt.Errorf("sync all failed: %v", err)
}
return nil
}
if c.dest == "" {
return cmdmain.UsageError("No --dest specified.")
}
discl := c.discoClient()
discl.SetLogger(c.logger)
src, err := discl.BlobRoot()
if err != nil {
return fmt.Errorf("Failed to get blob source: %v", err)
}
sc := client.New(src)
sc.SetupAuth()
sc.SetLogger(c.logger)
dc := client.New(c.dest)
dc.SetupAuth()
dc.SetLogger(c.logger)
var tc *client.Client
if c.third != "" {
tc = client.New(c.third)
tc.SetupAuth()
tc.SetLogger(c.logger)
}
passNum := 0
for {
passNum++
stats, err := c.doPass(sc, dc, tc)
if c.verbose {
log.Printf("sync stats - pass: %d, blobs: %d, bytes %d\n", passNum, stats.BlobsCopied, stats.BytesCopied)
}
if err != nil {
return fmt.Errorf("sync failed: %v", err)
}
if !c.loop {
break
}
}
return nil
}
示例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.SetupAuth()
return cl
}
示例3: 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 discoClient() *client.Client {
var cl *client.Client
if *flagSrc == "" {
cl = client.NewOrFail()
} else {
cl = client.New(*flagSrc)
}
cl.SetupAuth()
return cl
}
示例4: 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
}
示例5: client
func (c *claimsCmd) client() *client.Client {
var cl *client.Client
if c.src == "" {
cl = client.NewOrFail()
} else {
cl = client.New(c.src)
}
cl.SetLogger(c.logger)
cl.SetHTTPClient(&http.Client{
Transport: cl.TransportForConfig(nil),
})
cl.SetupAuth()
return cl
}
示例6: 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
}
示例7: newClient
// newClient returns a Camlistore client for the server.
// The server may be:
// * blank, to use the default in the config file
// * an alias, to use that named alias in the config file
// * host:port
// * https?://host[:port][/path]
func newClient(server string) *client.Client {
var cl *client.Client
if server == "" {
cl = client.NewOrFail()
} else {
cl = client.New(server)
if err := cl.SetupAuth(); err != nil {
log.Fatalf("Could not setup auth for connecting to %v: %v", server, err)
}
}
cl.SetHTTPClient(&http.Client{
Transport: cl.TransportForConfig(nil),
})
return cl
}