Skip to content

Commit

Permalink
convert pipe path to url
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzilladev committed Sep 26, 2023
1 parent f9b2574 commit dc7ccac
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/ngrok-connect-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ngrok.consoleLog("INFO"); // turn on info logging
(async function () {
const url = await ngrok.connect({
// session configuration
addr: `pipe:${UNIX_SOCKET}`,
addr: `unix:${UNIX_SOCKET}`,
// addr: `localhost:8080`,
// authtoken: "<authtoken>",
authtoken_from_env: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/ngrok-labeled.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ builder.connect().then((session) => {

/*
ngrok.connect({
addr: "pipe:" + UNIX_SOCKET,
addr: "unix:" + UNIX_SOCKET,
authtoken_from_env: true,
labels: "edge:edghts_<edge_id>",
proto: "labeled",
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts

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

10 changes: 7 additions & 3 deletions index.js

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

2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use napi_derive::napi;
#[derive(Default)]
pub struct Config {
/// Port, network address, or named pipe. Defaults to 80.
/// Examples: "80", "localhost:8080", "pipe:/tmp/my.sock"
/// Examples: "80", "localhost:8080", "unix:/tmp/my.sock", "pipe://./my-pipe"
#[napi(ts_type = "number|string")]
pub addr: Option<String>,
// Synonym for basic_auth
Expand Down
8 changes: 6 additions & 2 deletions trailer.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,12 @@ async function ngrokLinkPipe(tunnel, server) {
console.debug("Cannot change permissions of file: " + filename);
}
// forward tunnel
const proto = platform == "win32" ? "pipe:" : "unix:";
tunnel.forward(proto + filename);
var addr = "unix:" + filename;
if (platform == "win32") {
// convert pipe path to url
addr = "pipe:" + filename.replace("\\\\.\\pipe\\", "//./");
}
tunnel.forward(addr);
socket.path = filename; // surface to caller

return socket;
Expand Down

0 comments on commit dc7ccac

Please sign in to comment.