An alternate approach for launcher. The idea is to expose secure RESTFull APIs instead of the present IPC design. Which will allow developers to easily get started with the development on SafeNetwork. Moreover this would reduce the configuration required to bare minimum making the life of the end users easy too. Since RESTFull APIs are built on top of the standard HTTP Application layer protocol, the common tools used in practice every day can be used for debugging and development.
This file contains hidden or 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
instance.pullForPR = function(selectedPR) { | |
if (!openPR.hasOwnProperty(selectedPR)) { | |
return 'echo pull failed - PR not found for selection && exit 1'; | |
}var command; | |
var actualLocalBranchName; | |
actualLocalBranchName = selectedPR.replace(/ /g, '_'); | |
command = (branches.indexOf(actualLocalBranchName) > -1) ? 'git branch -D ' + actualLocalBranchName + ' && ': ''; | |
command += instance.CLI.checkout(openPR[selectedPR].base.ref) + '&&' + instance.CLI.pull() + '&&' + | |
instance.CLI.checkout(selectedPR, true) + '&&' + | |
instance.CLI.pullRemote(openPR[selectedPR].head.repo.clone_url, openPR[selectedPR].head.ref); |
This file contains hidden or 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
use std::sync::{Arc, Mutex, Condvar}; | |
use std::thread; | |
struct Producer { | |
cvar: Arc<(Mutex<bool>, Condvar)> | |
} | |
impl Producer { | |
pub fn new(cvar: Arc<(Mutex<bool>, Condvar)>) -> Producer { | |
Producer { |
This file contains hidden or 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
function pack(bytes) { | |
var chars = []; | |
for(var i = 0, n = bytes.length; i < n;) { | |
chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff)); | |
} | |
return String.fromCharCode.apply(null, chars); | |
} | |
function unpack(str) { | |
var bytes = []; |
This file contains hidden or 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
var sodium = require('libsodium-wrappers'); | |
var log = require('npmlog'); | |
// These are the commandline parameters from the launcher while starting the application | |
// Assign these values at run time, if trying this example | |
var HOST, PORT, LAUNCHER_NONCE; | |
var ResponseBufferHandler = function(onResponseCallback) { | |
var bufferQueue = []; |
This file contains hidden or 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
// libsodium wrappers is used for crypto | |
var libsodium = require('libsodium-wrappers'); | |
var httpRequest = require('request'); | |
// Generate Assymetric Key pairs | |
var assymetricKeys = libsodium.crypto_box_keypair(); | |
// Generate random Nonce | |
var nonce = libsodium.randombytes_buf(libsodium.crypto_box_NONCEBYTES);; | |
// Creating the authorisation request payload |
There are two main modes to run the Let's Encrypt client (called Certbot
):
- Standalone: replaces the webserver to respond to ACME challenges
- Webroot: needs your webserver to serve challenges from a known folder.
Webroot is better because it doesn't need to replace Nginx (to bind to port 80).
In the following, we're setting up mydomain.com
.
HTML is served from /var/www/mydomain
, and challenges are served from /var/www/letsencrypt
.