use header instead of cookie. this makes stuff simpler when using different auth.

parent 13392c1b
......@@ -35,13 +35,14 @@ const {ArgumentParser} = argparse;
help: "target host:port (port relative to server. required. otherwise starts server)"
});
parser.addArgument(["-c", "--cookie"], {
help: "specify a cookie file for authenticating to your backend"
parser.addArgument(["--header"], {
help: "specify a header json file for authenticating to your backend"
});
const args = parser.parseArgs();
if (args.cookie) args.cookie = (await readFileAsync(args.cookie, "utf8")).trim();
if (args.header) args.header = JSON.parse(await readFileAsync(args.header, "utf8"));
else args.header = undefined;
(await import(args.server === null || args.target === null ? "./server.mjs" : "./client.mjs")).default(args);
})();
......
......@@ -33,9 +33,7 @@ export default async args => {
con.on("message", data => sock.write(data.binaryData));
});
client.connect(args.server, undefined, undefined, args.cookie ? {
"Cookie": args.cookie
} : undefined);
client.connect(args.server, undefined, undefined, args.header);
sock.on("data", data => {
//console.log(`${new Date()} received browser data ${data.length}`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment