Skip to content

Commit

Permalink
Merge pull request #32 from 0xBEEFCAF3/mv-loin-nolooking
Browse files Browse the repository at this point in the history
Rename all instances of loin to nolooking
  • Loading branch information
DanGould authored Oct 26, 2022
2 parents bf93b3f + a9f1b81 commit 919dc3c
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 91 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "loin"
name = "nolooking"
version = "0.1.0"
authors = ["Dan Gould <[email protected]>", "Martin Habovstiak <[email protected]>"]
exclude = ["./tests/compose"]
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Good luck analyzing that!

### UX implications

All this is possible without loin by [manually exchanging PSBTs](https://github.com/lightningnetwork/lnd/blob/master/docs/psbt.md).
All this is possible without nolooking by [manually exchanging PSBTs](https://github.com/lightningnetwork/lnd/blob/master/docs/psbt.md).
BIP78 turns that tedious back and forth into scanning/clicking one link followed by confirmation in the wallet.
In other words, your grandmother will be able to somewhat privately open a bunch of channels for you, if she has a BIP78-capable wallet.

Expand All @@ -62,13 +62,13 @@ In other words, your grandmother will be able to somewhat privately open a bunch

0. You need Rust version 1.48 or higher to compile this.
1. You need LND v14.2 or higher
2. `cargo build [--features=test_paths]`. The test_paths feature will serve the `static/index.html` ui contained in this folder rather than one in `/usr/share/loin/static` in production.
2. `cargo build [--features=test_paths]`. The test_paths feature will serve the `static/index.html` ui contained in this folder rather than one in `/usr/share/nolooking/static` in production.
3. Setup reverse HTTP proxy with HTTPS forwarding to some port - e.g. 3000.
You can do this in a few lines using [selfhost in Cryptoanarchy Debian Repository](https://github.com/debian-cryptoanarchy/cryptoanarchy-deb-repo-builder/blob/master/docs/user-level.md#selfhost). or [on MacOS](https://www.storyblok.com/faq/setup-dev-server-https-proxy)
4. create a configuration file based on `config_spec.toml`. This is mine based on a [polar](https://lightningpolar.com/) lightning network simulator setup. `CONFIGURATION_FILE=loin.conf`:
4. create a configuration file based on `config_spec.toml`. This is mine based on a [polar](https://lightningpolar.com/) lightning network simulator setup. `CONFIGURATION_FILE=nolooking.conf`:

```configuration
# loin.conf
# nolooking.conf
bind_port=3000
endpoint="https://localhost:3010"
Expand All @@ -83,7 +83,7 @@ In other words, your grandmother will be able to somewhat privately open a bunch


Note: if `CHAIN_WALLET_AMOUNT_SATS` is present a single-sig output will be added to LND's internal wallet.
A minimum internal wallet balance of 10,000 reserve sats per channel up to 100,000 sats is required for anchor commitments. This [can be automated](https://github.com/Kixunil/loin/issues/11) in the future.
A minimum internal wallet balance of 10,000 reserve sats per channel up to 100,000 sats is required for anchor commitments. This [can be automated](https://github.com/Kixunil/loptos/issues/11) in the future.

## License

Expand Down
4 changes: 2 additions & 2 deletions config_spec.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[general]
env_prefix = "LOIN"
env_prefix = "NOLOOKING"
conf_file_param = "conf"
conf_dir_param = "conf_dir"
doc = """
Expand All @@ -11,7 +11,7 @@ This server optimizes your channel opening from a remote wallet which supports P
[[param]]
name = "bind_port"
type = "u16"
doc = "Loin HTTP port to listen on"
doc = "nolooking HTTP port to listen on"
optional = false

[[param]]
Expand Down
2 changes: 1 addition & 1 deletion src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::scheduler::{ScheduledPayJoin, Scheduler, self};
use std::net::SocketAddr;

#[cfg(not(feature = "test_paths"))]
const STATIC_DIR: &str = "/usr/share/loin/static";
const STATIC_DIR: &str = "/usr/share/nolooking/static";

#[cfg(feature = "test_paths")]
const STATIC_DIR: &str = "static";
Expand Down
48 changes: 0 additions & 48 deletions tests/compose/nginx/reverse-https-proxy.conf
Original file line number Diff line number Diff line change
@@ -1,52 +1,11 @@
#daemon on;
#user nobody;
#worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
#worker_connections 1024;
}


http {
#include mime.types;
#default_type application/octet-stream; #mime types missing or this conf belongs in /etc/nginx folder

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

#sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
#keepalive_timeout 65;

#gzip on;

# server {
# listen 3000;
# return 301 https://$host$request_uri;
# }

server {

listen 3010 ssl;
server_name localhost;
access_log /dev/stdout;
error_log /dev/stdout;


# access_log /var/log/nginx/loin.access.log;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
Expand All @@ -58,7 +17,6 @@ http {
proxy_read_timeout 90;
proxy_redirect off;

# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
Expand All @@ -68,12 +26,6 @@ http {

ssl_certificate /etc/ssl/localhost.pem;
ssl_certificate_key /etc/ssl/localhost-key.pem;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
}

include servers/*;
Expand Down
16 changes: 8 additions & 8 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ mod integration {
use bitcoincore_rpc::{Auth, Client, RpcApi};
use hyper::client::HttpConnector;
use ln_types::P2PAddress;
use loin::scheduler;
use loin::{scheduler::{ScheduledChannel, ScheduledPayJoin, Scheduler}, lnd::LndClient, http};
use nolooking::scheduler;
use nolooking::{scheduler::{ScheduledChannel, ScheduledPayJoin, Scheduler}, lnd::LndClient, http};
use std::collections::HashMap;
use std::convert::TryFrom;
use tempfile::tempdir;
Expand Down Expand Up @@ -51,7 +51,7 @@ mod integration {

};

// merchant lnd loin configuration
// merchant lnd nolooking configuration
let address_str = "https://localhost:53281";
let cert_file = format!("{}/merchant-tls.cert", &tmp_path).to_string();
let macaroon_file = format!("{}/merchant-admin.macaroon", &tmp_path).to_string();
Expand Down Expand Up @@ -98,8 +98,8 @@ mod integration {
"bind_port=3000\nendpoint=\"{}\"\nlnd_address=\"{}\"\nlnd_cert_path=\"{}\"\nlnd_macaroon_path=\"{}\"",
&endpoint.clone().to_string(), &address_str, &cert_file, &macaroon_file
);
let loin_conf = format!("{}/loin.conf", &tmp_path);
std::fs::write(&loin_conf, conf_string).expect("Unable to write loin.conf");
let nolooking_conf = format!("{}/nolooking.conf", &tmp_path);
std::fs::write(&nolooking_conf, conf_string).expect("Unable to write nolooking.conf");

Command::new("docker")
.arg("cp")
Expand Down Expand Up @@ -177,10 +177,10 @@ mod integration {
});

let bind_addr = ([127, 0, 0, 1], 3000).into();
let loin_server = http::serve(scheduler, bind_addr, endpoint.clone());
let nolooking_server = http::serve(scheduler, bind_addr, endpoint.clone());
// trigger payjoin-client
let payjoin_channel_open = tokio::spawn(async move {
// if we don't wait for loin server to run we'll make requests to a closed port
// if we don't wait for nolooking server to run we'll make requests to a closed port
std::thread::sleep(Duration::from_secs(2));
// TODO loop on ping 3000 until it the server is live

Expand Down Expand Up @@ -256,7 +256,7 @@ mod integration {

tokio::select! {
_ = payjoin_channel_open => println!("payjoin-client completed first"),
_ = loin_server => println!("loin server stopped first. This shouldn't happen"),
_ = nolooking_server => println!("nolooking server stopped first. This shouldn't happen"),
_ = tokio::time::sleep(Duration::from_secs(20)) => println!("payjoin timed out after 20 seconds"),
};

Expand Down

0 comments on commit 919dc3c

Please sign in to comment.