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

Add a service socket #603

Merged
merged 3 commits into from Jul 22, 2016
Merged

Add a service socket #603

merged 3 commits into from Jul 22, 2016

Conversation

Xaekai
Copy link
Collaborator

@Xaekai Xaekai commented Jul 16, 2016

to enable out of band access to the process commandline

}
})
}
} else if (line.indexOf("/clearban") === 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/unglobalban or something like that would be more consistent naming.

Replace the IP address regex with net.isIPv4(): https://nodejs.org/api/net.html#net_net_isipv4_input

@Xaekai Xaekai force-pushed the servicesocket branch 2 times, most recently from 07b41c5 to 4010ee9 Compare July 16, 2016 06:45
@Xaekai
Copy link
Collaborator Author

Xaekai commented Jul 16, 2016

Updated.

@@ -75,5 +76,31 @@ function handleLine(line) {
}
} else if (line.indexOf("/reload-partitions") === 0) {
sv.reloadPartitionMap();
} else if (line.indexOf("/globalban") === 0) {
var args = line.split(" "); args.shift();
if (args.length === 2 && net.isIPv4(args[0]) || net.isIPv6(args[0])) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operator precedence means that this is parsed as (args.length === 2 && net.isIPv4(args[0])) || net.isIPv6(args[0]), also if you want to support both you can just check if net.isIP() is nonzero.

@Xaekai Xaekai force-pushed the servicesocket branch 3 times, most recently from f832ca5 to 3cd9d71 Compare July 16, 2016 17:38
@Xaekai
Copy link
Collaborator Author

Xaekai commented Jul 16, 2016

Updated and retested.

Add one more command to the service commandline
@@ -45,6 +45,7 @@ process.stdin.on("data", function (data) {
}
});

var net = require('net');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused import

Copy link
Collaborator Author

@Xaekai Xaekai Jul 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not unused. It's used to to validate user input, which was your suggestion over a regex.

Edit: I can change it to just import the one function though.

@calzoneman calzoneman merged commit 71c5fe2 into calzoneman:3.0 Jul 22, 2016
@Xaekai Xaekai deleted the servicesocket branch June 6, 2017 02:51
@Xaekai Xaekai added this to Completed in Daemonize Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Daemonize
  
Completed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants