OSDN Git Service

Merge pull request #41 from Bytom/dev
[bytom/vapor.git] / vendor / github.com / ipfs / go-ipfs-api / bootstrap.go
1 package shell
2
3 import (
4         "context"
5 )
6
7 type PeersList struct {
8         Peers []string
9 }
10
11 func (s *Shell) BootstrapAdd(peers []string) ([]string, error) {
12         var addOutput PeersList
13         err := s.Request("bootstrap/add", peers...).Exec(context.Background(), &addOutput)
14         return addOutput.Peers, err
15 }
16
17 func (s *Shell) BootstrapAddDefault() ([]string, error) {
18         var addOutput PeersList
19         err := s.Request("bootstrap/add/default").Exec(context.Background(), &addOutput)
20         return addOutput.Peers, err
21 }
22
23 func (s *Shell) BootstrapRmAll() ([]string, error) {
24         var rmAllOutput PeersList
25         err := s.Request("bootstrap/rm/all").Exec(context.Background(), &rmAllOutput)
26         return rmAllOutput.Peers, err
27 }