From 7ab69f358e43032fa299746324393ec839ce24f3 Mon Sep 17 00:00:00 2001 From: Yilun Date: Sun, 2 Aug 2020 19:52:15 -0700 Subject: [PATCH] Allow tsconfig to be nil Signed-off-by: Yilun --- .gitignore | 3 +++ tunnel.go | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index de38988..e51b1c0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ vendor build nkn-tunnel main +Tunnel.framework +tunnel.aar +tunnel.jar diff --git a/tunnel.go b/tunnel.go index f600642..28f6729 100644 --- a/tunnel.go +++ b/tunnel.go @@ -57,11 +57,14 @@ func NewTunnel(numClients int, seed []byte, identifier, from, to string, session return nil, err } - tsConfigCopy := *tsConfig - tsConfigCopy.NumTunaListeners = numClients - tsConfigCopy.SessionConfig = sessionConfig + if tsConfig != nil { + tsConfigCopy := *tsConfig + tsConfigCopy.NumTunaListeners = numClients + tsConfigCopy.SessionConfig = sessionConfig + tsConfig = &tsConfigCopy + } - c, err = ts.NewTunaSessionClient(account, m, wallet, &tsConfigCopy) + c, err = ts.NewTunaSessionClient(account, m, wallet, tsConfig) if err != nil { return nil, err }