Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/types/generated/proxy_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 additions & 1 deletion app/src/types/generated/proxy_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions cmd/litcli/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ var litCommands = []cli.Command{
"specified as a hex string using a " +
"maximum of 8 characters.",
},
cli.BoolFlag{
Name: "stateless_init",
Usage: "When set, it will be assumed that " +
"the provided macaroon is one " +
"created by LND. It is required " +
"that the macaroon has the " +
"permissions required to bake a " +
"macaroon via LND. This option may " +
"only be set if LND is running in " +
"stateless-init mode within LiT.",
},
cli.StringFlag{
Name: "save_to",
Usage: "Save returned admin macaroon to " +
Expand Down Expand Up @@ -125,6 +136,7 @@ func bakeSuperMacaroon(ctx *cli.Context) error {
resp, err := client.BakeSuperMacaroon(
ctxb, &litrpc.BakeSuperMacaroonRequest{
RootKeyIdSuffix: suffix,
StatelessInit: ctx.IsSet("stateless_init"),
},
)
if err != nil {
Expand Down
35 changes: 23 additions & 12 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ type Config struct {
poolRemote bool
tapRemote bool

// Whether or not LND and LiT are running in stateless init mode.
statelessInitMode bool

// lndAdminMacaroon is the admin macaroon that is given to us by lnd
// over an in-memory connection on startup. This is only set in
// integrated lnd mode.
Expand All @@ -235,21 +238,32 @@ type Config struct {
func (c *Config) lndConnectParams() (string, lndclient.Network, string,
string, []byte) {

lndDialAddr := c.lndDialAddr()

// In remote lnd mode, we just pass along what was configured in the
// remote section of the lnd config.
if c.LndMode == ModeRemote {
return c.Remote.Lnd.RPCServer,
if c.lndRemote {
return lndDialAddr,
lndclient.Network(c.Network),
lncfg.CleanAndExpandPath(c.Remote.Lnd.TLSCertPath),
lncfg.CleanAndExpandPath(c.Remote.Lnd.MacaroonPath),
nil
}

// When we start lnd internally, we take the listen address as
// the client dial address. But with TLS enabled by default, we
// cannot call 0.0.0.0 internally when dialing lnd as that IP
// address isn't in the cert. We need to rewrite it to the
// loopback address.
return lndDialAddr, lndclient.Network(c.Network), "", "",
c.lndAdminMacaroon
}

// lndDialAddr returns the address to connect to LND on.
func (c *Config) lndDialAddr() string {
if c.lndRemote {
return c.Remote.Lnd.RPCServer
}

// When we start lnd internally, we take the listen address as the
// client dial address. But with TLS enabled by default, we cannot call
// 0.0.0.0 internally when dialing lnd as that IP address isn't in the
// cert. We need to rewrite it to the loopback address.
lndDialAddr := c.Lnd.RPCListeners[0].String()
switch {
case strings.Contains(lndDialAddr, "0.0.0.0"):
Expand All @@ -258,13 +272,10 @@ func (c *Config) lndConnectParams() (string, lndclient.Network, string,
)

case strings.Contains(lndDialAddr, "[::]"):
lndDialAddr = strings.Replace(
lndDialAddr, "[::]", "[::1]", 1,
)
lndDialAddr = strings.Replace(lndDialAddr, "[::]", "[::1]", 1)
}

return lndDialAddr, lndclient.Network(c.Network), "", "",
c.lndAdminMacaroon
return lndDialAddr
}

// defaultConfig returns a configuration struct with all default values set.
Expand Down
2 changes: 1 addition & 1 deletion litrpc/firewall.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions litrpc/firewall.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
"actions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcAction"
},
"description": "A list of actions performed by the autopilot server."
Expand Down Expand Up @@ -281,6 +282,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
4 changes: 2 additions & 2 deletions litrpc/lit-accounts.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions litrpc/lit-accounts.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@
"invoices": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcAccountInvoice"
},
"description": "The list of invoices created by the account. An invoice created by an\naccount will credit the account balance if it is settled."
},
"payments": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcAccountPayment"
},
"description": "The list of payments made by the account. A payment made by an account will\ndebit the account balance if it is settled."
Expand Down Expand Up @@ -281,6 +283,7 @@
"accounts": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcAccount"
},
"description": "All accounts in the account database."
Expand Down Expand Up @@ -312,6 +315,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
2 changes: 1 addition & 1 deletion litrpc/lit-autopilot.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions litrpc/lit-autopilot.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@
"permissions_list": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcPermissions"
},
"description": "A list of URI permissions required by the feature."
Expand Down Expand Up @@ -361,6 +362,7 @@
"sessions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcSession"
},
"description": "A list of the Autopilot sessions."
Expand All @@ -386,6 +388,7 @@
"permissions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcMacaroonPermission"
},
"description": "A list of permissions that should be included in the macaroon."
Expand Down Expand Up @@ -451,6 +454,7 @@
"operations": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcMacaroonPermission"
},
"description": "A list of the permissions required for this method."
Expand Down Expand Up @@ -696,6 +700,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
2 changes: 1 addition & 1 deletion litrpc/lit-sessions.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions litrpc/lit-sessions.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"macaroon_custom_permissions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcMacaroonPermission"
},
"description": "Any custom permissions to add the session's macaroon."
Expand Down Expand Up @@ -258,6 +259,7 @@
"sessions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcSession"
},
"description": "A list of sessions."
Expand All @@ -283,6 +285,7 @@
"permissions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/litrpcMacaroonPermission"
},
"description": "A list of permissions that should be included in the macaroon."
Expand Down Expand Up @@ -556,6 +559,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
2 changes: 1 addition & 1 deletion litrpc/lit-status.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions litrpc/lit-status.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
Expand Down
Loading
Loading