diff --git a/packages/sshnoports/lib/sshnp/sshnp.dart b/packages/sshnoports/lib/sshnp/sshnp.dart index ca7879452..6a184ea19 100644 --- a/packages/sshnoports/lib/sshnp/sshnp.dart +++ b/packages/sshnoports/lib/sshnp/sshnp.dart @@ -87,7 +87,7 @@ abstract class SSHNP { abstract final String namespace; /// When using sshrvd, this is fetched from sshrvd during [init] - abstract final String sshrvdPort; + String get sshrvdPort; /// Set to '$localPort $port $username $host $sessionId' during [init] abstract final String sshString; diff --git a/packages/sshnoports/lib/sshnp/sshnp_impl.dart b/packages/sshnoports/lib/sshnp/sshnp_impl.dart index e99ecd76c..973e2830a 100644 --- a/packages/sshnoports/lib/sshnp/sshnp_impl.dart +++ b/packages/sshnoports/lib/sshnp/sshnp_impl.dart @@ -114,8 +114,12 @@ class SSHNPImpl implements SSHNP { late final String namespace; /// When using sshrvd, this is fetched from sshrvd during [init] + /// This is only set when using sshrvd + /// (i.e. after [getHostAndPortFromSshrvd] has been called) @override - late final String sshrvdPort; + String get sshrvdPort => _sshrvdPort; + + late String _sshrvdPort; /// Set to '$localPort $port $username $host $sessionId' during [init] @override @@ -484,7 +488,7 @@ class SSHNPImpl implements SSHNP { List results = ipPorts.split(','); host = results[0]; port = results[1]; - sshrvdPort = results[2]; + _sshrvdPort = results[2]; sshrvdAck = true; }); @@ -525,7 +529,7 @@ class SSHNPImpl implements SSHNP { // Connect to rendezvous point using background process. // sshnp (this program) can then exit without issue. - unawaited(Process.run(getSshrvCommand(), [host, sshrvdPort])); + unawaited(Process.run(getSshrvCommand(), [host, _sshrvdPort])); } Future generateSshKeys() async {