Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #163

Merged
merged 6 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/zarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: Send result to Github Security
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: result.sarif
sarif_file: result.sarif
4 changes: 3 additions & 1 deletion .perlcriticrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
severity = 5

severity = 4

[-TestingAndDebugging::RequireUseStrict]
[-TestingAndDebugging::RequireUseWarnings]
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
FROM perl:5.38
FROM ubuntu:latest

COPY . /usr/src/nipe
WORKDIR /usr/src/nipe

RUN cpanm --installdeps .
EXPOSE 9050

RUN apt-get update && \
apt-get install -y cpanminus && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT [ "perl", "./nipe.pl" ]
RUN cpanm --installdeps .
RUN perl nipe.pl install
18 changes: 9 additions & 9 deletions lib/Nipe/Utils/Helper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ package Nipe::Utils::Helper {

sub new {
return "
\rCore Commands
\r==============
\r\tCommand Description
\r\t------- -----------
\r\tinstall Install dependencies
\r\tstart Start routing
\r\tstop Stop routing
\r\trestart Restart the Nipe circuit
\r\tstatus See status\n\n";
\rCore Commands
\r==============
\r\tCommand Description
\r\t------- -----------
\r\tinstall Install dependencies
\r\tstart Start routing
\r\tstop Stop routing
\r\trestart Restart the Nipe circuit
\r\tstatus See status\n\n";
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Nipe/Utils/Install.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package Nipe::Utils::Install {
sub new {
my %device = Nipe::Utils::Device -> new();
my $stopTor = "systemctl stop tor";

my %install = (
"debian" => "apt-get install -y tor iptables",
"fedora" => "dnf install -y tor iptables",
Expand Down
10 changes: 6 additions & 4 deletions lib/Nipe/Utils/Status.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
use HTTP::Tiny;

sub new {
my $apiCheck = "https://check.torproject.org/api/ip";
my $request = HTTP::Tiny -> new -> get($apiCheck);

if ($request -> {status} == 200) {
use constant SUCCESS_CODE => 200;

Check failure on line 8 in lib/Nipe/Utils/Status.pm

View workflow job for this annotation

GitHub Actions / critic

Pragma "constant" used at line 8, column 3. See page 55 of PBP.

my $apiCheck = "https://check.torproject.org/api/ip";
my $request = HTTP::Tiny -> new -> get($apiCheck);

if ($request -> {status} == SUCCESS_CODE) {
my $data = decode_json ($request -> {content});

my $checkIp = $data -> {"IP"};
Expand Down
2 changes: 1 addition & 1 deletion nipe.pl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

sub main {
my $argument = $ARGV[0];

if ($argument) {
die "Nipe must be run as root.\n" if $< != 0;

Expand Down
Loading