Skip to content

Commit d72d0a9

Browse files
committed
multi: move client conn creation func to mailbox
In this commit, the MailboxRPCConnection function is renamed and moved out of the core package and into the mailbox package.
1 parent 63d868e commit d72d0a9

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

cmd/wasm-client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (w *wasmClient) ConnectServer(_ js.Value, args []js.Value) interface{} {
212212
// in another goroutine here. See https://pkg.go.dev/syscall/js#FuncOf.
213213
go func() {
214214
var err error
215-
statusChecker, lndConnect, err := core.MailboxRPCConnection(
215+
statusChecker, lndConnect, err := mailbox.NewClientWebsocketConn(
216216
mailboxServer, pairingPhrase, localPriv, remotePub,
217217
func(key *btcec.PublicKey) error {
218218
return callJsCallback(

core/lnd_conn.go renamed to mailbox/create_conn.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
package core
1+
package mailbox
22

33
import (
44
"context"
55
"strings"
66

77
"github.com/btcsuite/btcd/btcec/v2"
8-
"github.com/lightninglabs/lightning-node-connect/mailbox"
98
"github.com/lightningnetwork/lnd/keychain"
109
"google.golang.org/grpc"
1110
)
1211

13-
// MailboxRPCConnection returns a merged map of all litd's method
14-
// permissions.
15-
func MailboxRPCConnection(mailboxServer, pairingPhrase string,
12+
// NewClientWebsocketConn attempts to create websocket LNC client connection to
13+
// a server connection listening at the given mailbox server.
14+
func NewClientWebsocketConn(mailboxServer, pairingPhrase string,
1615
localStatic keychain.SingleKeyECDH, remoteStatic *btcec.PublicKey,
1716
onRemoteStatic func(key *btcec.PublicKey) error,
18-
onAuthData func(data []byte) error) (func() mailbox.ClientStatus,
17+
onAuthData func(data []byte) error) (func() ClientStatus,
1918
func() (*grpc.ClientConn, error), error) {
2019

2120
words := strings.Split(pairingPhrase, " ")
22-
var mnemonicWords [mailbox.NumPassphraseWords]string
21+
22+
var mnemonicWords [NumPassphraseWords]string
2323
copy(mnemonicWords[:], words)
24-
entropy := mailbox.PassphraseMnemonicToEntropy(mnemonicWords)
24+
entropy := PassphraseMnemonicToEntropy(mnemonicWords)
2525

26-
connData := mailbox.NewConnData(
26+
connData := NewConnData(
2727
localStatic, remoteStatic, entropy[:], nil, onRemoteStatic,
2828
onAuthData,
2929
)
3030

3131
ctx := context.Background()
32-
transportConn, err := mailbox.NewWebsocketsClient(
32+
transportConn, err := NewWebsocketsClient(
3333
ctx, mailboxServer, connData,
3434
)
3535
if err != nil {
3636
return nil, nil, err
3737
}
3838

39-
noiseConn := mailbox.NewNoiseGrpcConn(connData)
39+
noiseConn := NewNoiseGrpcConn(connData)
4040

4141
dialOpts := []grpc.DialOption{
4242
grpc.WithContextDialer(transportConn.Dial),

mobile/mobile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func ConnectServer(nameSpace string, mailboxServer string, isDevServer bool,
198198
return
199199
}
200200

201-
statusChecker, lndConnect, err := core.MailboxRPCConnection(
201+
statusChecker, lndConnect, err := mailbox.NewClientWebsocketConn(
202202
mailboxServer, pairingPhrase, localPriv, remotePub,
203203
func(key *btcec.PublicKey) error {
204204
mc.mutex.Lock()

0 commit comments

Comments
 (0)