-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #507 from atsign-foundation/refactor/noports_core
refactor: noports core
- Loading branch information
Showing
87 changed files
with
2,229 additions
and
1,943 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: verify_cli_tags | ||
description: | | ||
Ensures that the tag of sshnoports matches the tag of the composite. | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Ensure pubspec.yaml matches version.dart | ||
shell: bash | ||
working-directory: ./packages/sshnoports | ||
run: | | ||
DART_TAG="v$(egrep -o '^const String version = "(.*)";' lib/version.dart | cut -d'"' -f2)" | ||
PUBSPEC_TAG="v$(egrep -o '^version: (.*)$' pubspec.yaml | cut -d':' -f2 | tr -d '[:space:]')" | ||
if [ "$PUBSPEC_TAG" != "$DART_TAG" ]; then | ||
echo "Tag $PUBSPEC_TAG does not match version in version.dart: $DART_TAG" | ||
exit 1 | ||
fi | ||
- name: Ensure version.dart matches git ref (if current git ref is a version tag) | ||
shell: bash | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
working-directory: ./packages/sshnoports | ||
run: | | ||
# check version.dart | ||
REF=${{ github.ref }} | ||
TAG=${REF:10} | ||
DART_TAG="v$(egrep -o '^const String version = "(.*)";' lib/version.dart | cut -d'"' -f2)" | ||
if [ "$TAG" != "$DART_TAG" ]; then | ||
echo "Tag $TAG does not match version in version.dart: $DART_TAG" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: verify_core_tags | ||
description: | | ||
Ensures that the tag of noports_core matches the tag of the composite. | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Ensure pubspec.yaml matches version.dart | ||
shell: bash | ||
working-directory: ./packages/noports_core | ||
run: | | ||
DART_TAG="v$(grep -Po '^const String version = "(.*)";' lib/version.dart | cut -d'"' -f2)" | ||
PUBSPEC_TAG="v$(egrep -o '^version: (.*)$' pubspec.yaml | cut -d':' -f2 | tr -d '[:space:]')" | ||
if [ "$PUBSPEC_TAG" != "$DART_TAG" ]; then | ||
echo "Tag $PUBSPEC_TAG does not match version in version.dart: $DART_TAG" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: unit_tests | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- trunk | ||
|
||
pull_request: | ||
branches: | ||
- trunk | ||
|
||
jobs: | ||
cli_tags: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- uses: ./.github/composite/verify_cli_tags | ||
core_tags: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- uses: ./.github/composite/verify_core_tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# 4.0.0-dev.1 | ||
# 4.0.0 | ||
|
||
- Initial release based of the 4.0.0 pre-release code of sshnoports | ||
- Initial release based off of the 4.0.0 pre-release code of sshnoports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:noports_core/src/common/supported_ssh_clients.dart'; | ||
import 'package:noports_core/sshrv.dart'; | ||
|
||
class DefaultArgs { | ||
const DefaultArgs(); | ||
|
||
static const namespace = 'sshnp'; | ||
|
||
static const verbose = false; | ||
static const rsa = false; | ||
static const rootDomain = 'root.atsign.org'; | ||
static const sshrvGenerator = SSHRV.exec; | ||
static const localSshdPort = 22; | ||
static const remoteSshdPort = 22; | ||
|
||
/// value in seconds after which idle ssh tunnels will be closed | ||
static const idleTimeout = 15; | ||
static const help = false; | ||
} | ||
|
||
class DefaultSSHNPArgs { | ||
static const device = 'default'; | ||
static const port = 22; | ||
static const localPort = 0; | ||
static const sendSshPublicKey = ''; | ||
static const localSshOptions = <String>[]; | ||
static const legacyDaemon = false; | ||
static const listDevices = false; | ||
static const sshClient = SupportedSshClient.exec; | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/noports_core/lib/src/common/supported_ssh_clients.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
enum SupportedSshClient { | ||
exec(cliArg: '/usr/bin/ssh'), | ||
dart(cliArg: 'pure-dart'); | ||
|
||
final String cliArg; | ||
const SupportedSshClient({required this.cliArg}); | ||
|
||
factory SupportedSshClient.fromCliArg(String cliArg) { | ||
switch (cliArg) { | ||
case '/usr/bin/ssh': | ||
return SupportedSshClient.exec; | ||
case 'pure-dart': | ||
return SupportedSshClient.dart; | ||
default: | ||
throw ArgumentError('Unsupported SSH client: $cliArg'); | ||
} | ||
} | ||
} |
Oops, something went wrong.