You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.4 KiB

  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "sync"
  6. "github.com/btcsuite/btcutil"
  7. "github.com/lightninglabs/loop/client"
  8. "github.com/lightningnetwork/lnd/lntypes"
  9. "github.com/urfave/cli"
  10. )
  11. const (
  12. defaultListenPort = 11010
  13. defaultConfTarget = int32(2)
  14. )
  15. var (
  16. defaultListenAddr = fmt.Sprintf("localhost:%d", defaultListenPort)
  17. defaultSwapletDir = btcutil.AppDataDir("swaplet", false)
  18. swaps = make(map[lntypes.Hash]client.SwapInfo)
  19. subscribers = make(map[int]chan<- interface{})
  20. nextSubscriberID int
  21. swapsLock sync.Mutex
  22. )
  23. func main() {
  24. app := cli.NewApp()
  25. app.Flags = []cli.Flag{
  26. cli.StringFlag{
  27. Name: "network",
  28. Value: "mainnet",
  29. Usage: "network to run on (regtest, testnet, mainnet)",
  30. },
  31. cli.StringFlag{
  32. Name: "lnd",
  33. Value: "localhost:10009",
  34. Usage: "lnd instance rpc address host:port",
  35. },
  36. cli.StringFlag{
  37. Name: "swapserver",
  38. Value: "swap.lightning.today:11009",
  39. Usage: "swap server address host:port",
  40. },
  41. cli.StringFlag{
  42. Name: "macaroonpath",
  43. Usage: "path to lnd macaroon",
  44. },
  45. cli.StringFlag{
  46. Name: "tlspath",
  47. Usage: "path to lnd tls certificate",
  48. },
  49. cli.BoolFlag{
  50. Name: "insecure",
  51. Usage: "disable tls",
  52. },
  53. }
  54. app.Version = "0.0.1"
  55. app.Usage = "swaps execution daemon"
  56. app.Commands = []cli.Command{viewCommand}
  57. app.Action = daemon
  58. err := app.Run(os.Args)
  59. if err != nil {
  60. fmt.Println(err)
  61. }
  62. }