Skip to content

Commit 7168da5

Browse files
authored
Merge pull request #746 from bitromortac/privacy-flags
firewall: session-dependent privacy flags
2 parents ac4be79 + 5129b95 commit 7168da5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2546
-1313
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
run:
22
# timeout for analysis
3-
deadline: 4m
3+
timeout: 4m
44

55
build-tags:
66
- autopilotrpc

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ ifneq ($(workers),)
8383
LINT_WORKERS = --concurrency=$(workers)
8484
endif
8585

86-
DOCKER_TOOLS = docker run -v $$(pwd):/build litd-tools
86+
DOCKER_TOOLS = docker run \
87+
-v $(shell bash -c "go env GOCACHE || (mkdir -p /tmp/go-cache; echo /tmp/go-cache)"):/tmp/build/.cache \
88+
-v $(shell bash -c "go env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \
89+
-v $(shell bash -c "mkdir -p /tmp/go-lint-cache; echo /tmp/go-lint-cache"):/root/.cache/golangci-lint \
90+
-v $$(pwd):/build litd-tools
8791

8892
ITEST_TAGS := integration itest $(LND_RELEASE_TAGS)
8993
ITEST_LDFLAGS := $(call make_ldflags, $(ITEST_TAGS))

app/src/types/generated/lit-autopilot_pb.d.ts

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-autopilot_pb.js

Lines changed: 85 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-sessions_pb.d.ts

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/types/generated/lit-sessions_pb.js

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/util/tests/sampleData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ export const litListSessions: LIT.ListSessionsResponse.AsObject = {
977977
],
978978
],
979979
featureConfigsMap: [['SampleFeature', '{}']],
980+
privacyFlags: '0',
980981
},
981982
{
982983
id: '',
@@ -1059,6 +1060,7 @@ export const litListSessions: LIT.ListSessionsResponse.AsObject = {
10591060
],
10601061
],
10611062
featureConfigsMap: [['SampleFeature', '{}']],
1063+
privacyFlags: '0',
10621064
},
10631065
],
10641066
};

autopilotserver/client.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ func (c *Client) ListFeatures(ctx context.Context) (map[string]*Feature,
362362
Permissions: perms,
363363
Rules: rules,
364364
DefaultConfig: feature.DefaultConfig,
365+
PrivacyFlags: feature.PrivacyFlags,
365366
}
366367
}
367368

@@ -378,11 +379,12 @@ func (c *Client) ListFeatures(ctx context.Context) (map[string]*Feature,
378379
// Note: this is part of the Autopilot interface.
379380
func (c *Client) RegisterSession(ctx context.Context, pubKey *btcec.PublicKey,
380381
mailboxAddr string, devServer bool, featureConf map[string][]byte,
381-
groupKey *btcec.PublicKey, linkSig []byte) (*btcec.PublicKey, error) {
382+
groupKey *btcec.PublicKey, linkSig []byte,
383+
privacyFlags uint64) (*btcec.PublicKey, error) {
382384

383385
remotePub, err := c.registerSession(
384386
ctx, pubKey, mailboxAddr, devServer, featureConf,
385-
groupKey, linkSig,
387+
groupKey, linkSig, privacyFlags,
386388
)
387389
if err != nil {
388390
log.Errorf("unsuccessful registration of session %x",
@@ -428,8 +430,8 @@ func (c *Client) trackClient(pubKey *btcec.PublicKey) {
428430
// public key with the autopilot server.
429431
func (c *Client) registerSession(ctx context.Context, pubKey *btcec.PublicKey,
430432
mailboxAddr string, devServer bool, featureConfig map[string][]byte,
431-
groupLocalPub *btcec.PublicKey, linkSig []byte) (*btcec.PublicKey,
432-
error) {
433+
groupLocalPub *btcec.PublicKey, linkSig []byte,
434+
privacyFlags uint64) (*btcec.PublicKey, error) {
433435

434436
client, cleanup, err := c.getClientConn()
435437
if err != nil {
@@ -452,6 +454,7 @@ func (c *Client) registerSession(ctx context.Context, pubKey *btcec.PublicKey,
452454
LndVersion: marshalVersion(c.cfg.LndVersion),
453455
GroupResponderKey: groupKey,
454456
GroupResponderSig: linkSig,
457+
PrivacyFlags: privacyFlags,
455458
},
456459
)
457460
if err != nil {

autopilotserver/client_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ func TestAutopilotClient(t *testing.T) {
4545
require.ErrorContains(t, err, "no such client")
4646

4747
// Register the client.
48-
_, err = client.RegisterSession(ctx, pubKey, "", false, nil, nil, nil)
48+
_, err = client.RegisterSession(
49+
ctx, pubKey, "", false, nil, nil, nil, 0,
50+
)
4951
require.NoError(t, err)
5052

5153
// Assert that the server sees the new client and has it in the Active

autopilotserver/interface.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type Autopilot interface {
3030
RegisterSession(ctx context.Context, pubKey *btcec.PublicKey,
3131
mailboxAddr string, devServer bool,
3232
featureConf map[string][]byte, linkedGroupKey *btcec.PublicKey,
33-
linkSig []byte) (*btcec.PublicKey, error)
33+
linkSig []byte, privacyFlags uint64) (*btcec.PublicKey, error)
3434

3535
// ActivateSession attempts to inform the autopilot server that the
3636
// given session is still active. After this is called, the autopilot
@@ -73,6 +73,9 @@ type Feature struct {
7373
// represents the default configuration we can use if the user doesn't
7474
// specify any.
7575
DefaultConfig []byte
76+
77+
// PrivacyFlags is a list of privacy flags that the feature requires.
78+
PrivacyFlags uint64
7679
}
7780

7881
// RuleValues holds the default value along with the sane max and min values

0 commit comments

Comments
 (0)