Skip to content

Commit

Permalink
Merge pull request #596 from atsign-foundation/ci/no-snoop-rvd-build
Browse files Browse the repository at this point in the history
ci: no snooping rvd build + windows build configuration
  • Loading branch information
XavierChanth committed Dec 2, 2023
2 parents 0dd87fe + fa200b1 commit d718e6e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/multibuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,33 @@ jobs:
include:
- os: ubuntu-latest
output-name: sshnp-linux-x64
ext: ''
- os: macOS-latest
output-name: sshnp-macos-x64
ext: ''
- os: windows-latest
output-name: sshnp-windows-x64
ext: '.exe'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # v1.6.0
- run: mkdir sshnp
- run: mkdir tarball
- if: ${{ matrix.os != 'windows-latest' }}
run: mkdir sshnp/debug
- run: dart pub get
- run: dart run build_runner build --delete-conflicting-outputs
- run: dart compile exe bin/activate_cli.dart -v -o sshnp/at_activate
- run: dart compile exe bin/sshnp.dart -v -o sshnp/sshnp
- run: dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd
- run: dart compile exe bin/sshrv.dart -v -o sshnp/sshrv
- run: dart compile exe bin/sshrvd.dart -v -o sshnp/sshrvd
- run: dart compile exe bin/activate_cli.dart -v -o sshnp/at_activate${{ matrix.ext }}
- run: dart compile exe bin/sshnp.dart -v -o sshnp/sshnp${{ matrix.ext }}
- if: ${{ matrix.os != 'windows-latest' }}
run: dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd${{ matrix.ext }}
- if: ${{ matrix.os != 'windows-latest' }}
run: dart compile exe bin/sshrv.dart -v -o sshnp/sshrv${{ matrix.ext }}
- if: ${{ matrix.os != 'windows-latest' }}
run: dart compile exe bin/sshrvd.dart -v -o sshnp/sshrvd${{ matrix.ext }}
- if: ${{ matrix.os != 'windows-latest' }}
run: dart compile exe bin/sshrvd.dart -D ENABLE_SNOOP=true -v -o sshnp/debug/sshrvd${{ matrix.ext }}
- run: cp -r templates sshnp/templates
- run: cp LICENSE sshnp
- run: tar -cvzf tarball/${{ matrix.output-name }}.tgz sshnp
Expand Down
4 changes: 4 additions & 0 deletions packages/noports_core/lib/src/sshrvd/build_env.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class BuildEnv {
static final bool enableSnoop =
bool.fromEnvironment('ENABLE_SNOOP', defaultValue: false);
}
11 changes: 9 additions & 2 deletions packages/noports_core/lib/src/sshrvd/sshrvd_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:at_client/at_client.dart';
import 'package:at_utils/at_logger.dart';
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:noports_core/src/sshrvd/build_env.dart';
import 'package:noports_core/src/sshrvd/socket_connector.dart';
import 'package:noports_core/src/sshrvd/sshrvd.dart';
import 'package:noports_core/src/sshrvd/sshrvd_params.dart';
Expand Down Expand Up @@ -168,8 +169,14 @@ class SshrvdImpl implements Sshrvd {
/// Spawn an isolate and wait for it to send back the issued port numbers
ReceivePort receivePort = ReceivePort(session);

ConnectorParams parameters =
(receivePort.sendPort, portA, portB, session, forAtsign, snoop);
ConnectorParams parameters = (
receivePort.sendPort,
portA,
portB,
session,
forAtsign,
BuildEnv.enableSnoop && snoop,
);

logger
.info("Spawning socket connector isolate with parameters $parameters");
Expand Down
17 changes: 10 additions & 7 deletions packages/noports_core/lib/src/sshrvd/sshrvd_params.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:args/args.dart';
import 'package:noports_core/src/common/file_system_utils.dart';
import 'package:noports_core/src/sshrvd/build_env.dart';

class SshrvdParams {
final String username;
Expand Down Expand Up @@ -43,7 +44,7 @@ class SshrvdParams {
managerAtsign: r['manager'],
ipAddress: r['ip'],
verbose: r['verbose'],
snoop: r['snoop'],
snoop: BuildEnv.enableSnoop && r['snoop'],
rootDomain: r['root-domain'],
);
}
Expand Down Expand Up @@ -84,12 +85,14 @@ class SshrvdParams {
abbr: 'v',
help: 'More logging',
);
parser.addFlag(
'snoop',
abbr: 's',
defaultsTo: false,
help: 'Snoop on traffic passing through service',
);
if (BuildEnv.enableSnoop) {
parser.addFlag(
'snoop',
abbr: 's',
defaultsTo: false,
help: 'Snoop on traffic passing through service',
);
}
parser.addOption(
'root-domain',
mandatory: false,
Expand Down
3 changes: 2 additions & 1 deletion packages/sshnoports/tools/Dockerfile.package
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN set -eux; \
arm64) ARCH="arm64";; \
riscv64) ARCH="riscv64";; \
esac; \
mkdir sshnp; \
mkdir -p sshnp/debug; \
mkdir tarball; \
dart pub get; \
dart run build_runner build --delete-conflicting-outputs; \
Expand All @@ -18,6 +18,7 @@ RUN set -eux; \
dart compile exe bin/sshnpd.dart -v -o sshnp/sshnpd; \
dart compile exe bin/sshrv.dart -v -o sshnp/sshrv; \
dart compile exe bin/sshrvd.dart -v -o sshnp/sshrvd; \
dart compile exe bin/sshrvd.dart -D ENABLE_SNOOP=true -v -o sshnp/debug/sshrvd; \
cp -r templates sshnp/templates; \
cp LICENSE sshnp/; \
tar -cvzf tarball/sshnp-linux-${ARCH}.tgz sshnp
Expand Down

0 comments on commit d718e6e

Please sign in to comment.