Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #947 from trigun117/TS_gencerts
Browse files Browse the repository at this point in the history
Cleanup comments
  • Loading branch information
placer14 committed May 16, 2018
2 parents aebb4b2 + 98cfe4b commit 68c296a
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 31 deletions.
2 changes: 0 additions & 2 deletions cmd/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ import (
"time"
)

//Convert struct
type Convert struct {
Password string `short:"p" long:"password" description:"the encryption password if the database is encrypted"`
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
Testnet bool `short:"t" long:"testnet" description:"use the test network"`
}

//Execute convert command
func (x *Convert) Execute(args []string) error {
if len(args) == 0 {
fmt.Fprintf(os.Stderr, "Please specify the cryptocurrency you wish to convert to. Examples:\nopenbazaar-go convert bitcoin\nopenbazaar-go convert bitcoincash\nopenbazaar-go convert zcash /path/to/zcashd\n")
Expand Down
2 changes: 0 additions & 2 deletions cmd/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import (
"golang.org/x/crypto/ssh/terminal"
)

//DecryptDatabase struct
type DecryptDatabase struct {
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
}

//Execute decryptdatabase command
func (x *DecryptDatabase) Execute(args []string) error {
reader := bufio.NewReader(os.Stdin)

Expand Down
2 changes: 0 additions & 2 deletions cmd/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import (
"golang.org/x/crypto/ssh/terminal"
)

//EncryptDatabase struct
type EncryptDatabase struct {
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
}

//Execute encryptdatabase command
func (x *EncryptDatabase) Execute(args []string) error {
reader := bufio.NewReader(os.Stdin)
var repoPath string
Expand Down
2 changes: 0 additions & 2 deletions cmd/gencerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ import (
"github.com/OpenBazaar/openbazaar-go/repo"
)

// GenerateCertificates struct
type GenerateCertificates struct {
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
Testnet bool `short:"t" long:"testnet" description:"config file is for testnet node"`
Host string `short:"h" long:"host" description:"comma-separated hostnames and IPs to generate a certificate for"`
ValidFor time.Duration `long:"duration" description:"duration that certificate is valid for"`
}

// Execute gencerts command
func (x *GenerateCertificates) Execute(args []string) error {

flag.Parse()
Expand Down
2 changes: 0 additions & 2 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

var log = logging.MustGetLogger("cmd")

//Init struct
type Init struct {
Password string `short:"p" long:"password" description:"the encryption password if the database is to be encrypted"`
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
Expand All @@ -23,7 +22,6 @@ type Init struct {
WalletCreationDate string `short:"w" long:"walletcreationdate" description:"specify the date the seed was created. if omitted the wallet will sync from the oldest checkpoint."`
}

//Execute init command
func (x *Init) Execute(args []string) error {
// Set repo path
repoPath, err := repo.GetRepoPath(x.Testnet)
Expand Down
4 changes: 0 additions & 4 deletions cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type Restore struct {
WalletCreationDate string `short:"w" long:"walletcreationdate" description:"specify the date the seed was created. if omitted the wallet will sync from the oldest checkpoint."`
}

//Execute restore command
func (x *Restore) Execute(args []string) error {
reader := bufio.NewReader(os.Stdin)
if x.Mnemonic == "" {
Expand Down Expand Up @@ -333,7 +332,6 @@ func (x *Restore) Execute(args []string) error {
return nil
}

//RestoreFile restore the file
func RestoreFile(repoPath, peerID, filename string, ctx commands.Context, wg *sync.WaitGroup) {
defer wg.Done()
b, err := ipfs.ResolveThenCat(ctx, ipfspath.FromString(path.Join(peerID, filename)), time.Minute)
Expand All @@ -348,7 +346,6 @@ func RestoreFile(repoPath, peerID, filename string, ctx commands.Context, wg *sy
}
}

//RestoreDirectory restore the directory
func RestoreDirectory(repoPath, directory string, nd *ipfscore.IpfsNode, id *cid.Cid, wg *sync.WaitGroup) {
defer wg.Done()
links, err := nd.DAG.GetLinks(context.Background(), id)
Expand Down Expand Up @@ -378,7 +375,6 @@ func RestoreDirectory(repoPath, directory string, nd *ipfscore.IpfsNode, id *cid

}

//PrintError print error
func PrintError(e string) {
os.Stderr.Write([]byte(e))
}
2 changes: 0 additions & 2 deletions cmd/setapicreds.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ import (
"syscall"
)

//SetAPICreds struct
type SetAPICreds struct {
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
Testnet bool `short:"t" long:"testnet" description:"config file is for testnet node"`
}

//Execute setapicreds command
func (x *SetAPICreds) Execute(args []string) error {
// Set repo path
repoPath, err := repo.GetRepoPath(x.Testnet)
Expand Down
10 changes: 0 additions & 10 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ var fileLogFormat = logging.MustStringFormatter(
`%{time:15:04:05.000} [%{shortfunc}] [%{level}] %{message}`,
)

//ErrNoGateways
var (
ErrNoGateways = errors.New("No gateway addresses configured")
)

//Start struct
type Start struct {
Password string `short:"p" long:"password" description:"the encryption password if the database is encrypted"`
Testnet bool `short:"t" long:"testnet" description:"use the test network"`
Expand All @@ -119,7 +117,6 @@ type Start struct {
ZCash string `long:"zcash" description:"use a ZCash wallet in a dedicated data directory. To use this you must pass in the location of the zcashd binary."`
}

//Execute start command
func (x *Start) Execute(args []string) error {
printSplashScreen(x.Verbose)

Expand Down Expand Up @@ -893,30 +890,25 @@ func printSwarmAddrs(node *ipfscore.IpfsNode) {
}
}

//DummyWriter struct
type DummyWriter struct{}

func (d *DummyWriter) Write(p []byte) (n int, err error) {
return 0, nil
}

//DummyListener struct
type DummyListener struct {
addr net.Addr
}

//Addr return addr
func (d *DummyListener) Addr() net.Addr {
return d.addr
}

//Accept retunr conn
func (d *DummyListener) Accept() (net.Conn, error) {
conn, _ := net.FileConn(nil)
return conn, nil
}

//Close return nil
func (d *DummyListener) Close() error {
return nil
}
Expand Down Expand Up @@ -991,7 +983,6 @@ func newHTTPGateway(node *core.OpenBazaarNode, authCookie http.Cookie, config re
return api.NewGateway(node, authCookie, gwLis.NetListener(), config, ml, opts...)
}

//DHTOption variable
var DHTOption ipfscore.RoutingOption = constructDHTRouting

func constructDHTRouting(ctx context.Context, host p2phost.Host, dstore ipfsrepo.Datastore) (routing.IpfsRouting, error) {
Expand Down Expand Up @@ -1063,7 +1054,6 @@ func serveHTTPApi(cctx *commands.Context) (<-chan error, error) {
return errc, nil
}

//InitializeRepo initialize repo
func InitializeRepo(dataDir, password, mnemonic string, testnet bool, creationDate time.Time) (*db.SQLiteDatastore, error) {
// Database
sqliteDB, err := db.Create(dataDir, password, testnet)
Expand Down
2 changes: 0 additions & 2 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import (
"os"
)

//Status strcut
type Status struct {
DataDir string `short:"d" long:"datadir" description:"specify the data directory to be used"`
Testnet bool `short:"t" long:"testnet" description:"use the test network"`
}

//Execute status command
func (x *Status) Execute(args []string) error {
// Set repo path
repoPath, err := repo.GetRepoPath(x.Testnet)
Expand Down
3 changes: 0 additions & 3 deletions openbazaard.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ import (

var log = logging.MustGetLogger("main")

//Opts contain version flag
type Opts struct {
Version bool `short:"v" long:"version" description:"Print the version number and exit"`
}

//Stop struct
type Stop struct{}

//Restart struct
type Restart struct{}

var stopServer Stop
Expand Down

0 comments on commit 68c296a

Please sign in to comment.