mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 15:43:22 +01:00
checkpoint
This commit is contained in:
parent
3a9f26eeaf
commit
68ac00b344
96
sdk/node/examples/pastebin/dist/index.js
vendored
96
sdk/node/examples/pastebin/dist/index.js
vendored
@ -1,96 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const { Command } = require("commander");
|
||||
const zrok = require("zrok");
|
||||
const ziti = require('@openziti/ziti-sdk-nodejs');
|
||||
const express = require('express');
|
||||
var readlineSync = require('readline-sync');
|
||||
const program = new Command();
|
||||
program
|
||||
.command('copyto')
|
||||
.version("1.0.0")
|
||||
.description("command to host content to be pastedfrom'd")
|
||||
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var data = readlineSync.question('Input some text... ');
|
||||
console.log("data is: ", data);
|
||||
let root = zrok.Load();
|
||||
yield zrok.init(root);
|
||||
//await ziti.init( root.env.ZitiIdentity ).catch(( err: Error ) => { console.error(err); return process.exit(1) });
|
||||
ziti.setLogLevel(0);
|
||||
console.log("setting up zrok.CreateShare...");
|
||||
let shr = yield zrok.CreateShare(root, new zrok.ShareRequest(zrok.TCP_TUNNEL_BACKEND_MODE, zrok.PUBLIC_SHARE_MODE, "pastebin", ["public"]));
|
||||
// console.log("zrok share is: ",shr)
|
||||
// console.log("setting up app")
|
||||
// let service = "ns5ix2brb61f"
|
||||
// console.log("attempting to bind to service: "+ shr.Token)
|
||||
console.log("access your pastebin using 'pastefrom ", shr.Token);
|
||||
// let listener = await zrok.NewListener(shr.Token, root)
|
||||
// console.log("zrok listener is: ", listener)
|
||||
let app = ziti.express(express, shr.Token);
|
||||
// console.log("after setting up app")
|
||||
app.get('/', function (_, res) {
|
||||
// console.log("received a GET request")
|
||||
res.write(data);
|
||||
res.end();
|
||||
});
|
||||
// console.log("after setting up get")
|
||||
app.listen(undefined, () => {
|
||||
// console.log(`Example app listening!`)
|
||||
});
|
||||
// console.log("after listen")
|
||||
// zrok.DeleteShare(root, shr);
|
||||
}));
|
||||
program
|
||||
.command('pastefrom <shrToken>')
|
||||
.version("1.0.0")
|
||||
.description("command to paste content from coptyo")
|
||||
.action((shrToken) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
// ziti.setLogLevel(99)
|
||||
let root = zrok.Load();
|
||||
yield zrok.init(root).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
let acc = yield zrok.CreateAccess(root, new zrok.AccessRequest(shrToken));
|
||||
// console.log("zrok.CreateAccess returned: ", acc)
|
||||
// console.log("about to ziti.httpRequest: ", shrToken)
|
||||
// setTimeout(function() {
|
||||
ziti.httpRequest(shrToken, undefined, 'GET', '/', [], (data) => {
|
||||
console.log("in on_req_cb");
|
||||
console.log("data is: ", data);
|
||||
}, (data) => {
|
||||
console.log("in on_resp_cb");
|
||||
console.log("data is: ", data);
|
||||
}, (data) => {
|
||||
console.log("in on_resp_data_cb");
|
||||
console.log("data is: ", data);
|
||||
if (data.body) {
|
||||
console.log('----------- pastefrom is: ', data.body.toString());
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
// }, 5000);
|
||||
// zrok.dialer(
|
||||
// root,
|
||||
// shrToken,
|
||||
// (conn: any) => {
|
||||
// console.log("in connectCallback")
|
||||
// console.log("conn is: ", conn)
|
||||
// },
|
||||
// (dataData: any) => {
|
||||
// console.log("in dataCallback")
|
||||
// console.log(dataData.toString())
|
||||
// }
|
||||
// );
|
||||
}));
|
||||
program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
//# sourceMappingURL=index.js.map
|
1
sdk/node/examples/pastebin/dist/index.js.map
vendored
1
sdk/node/examples/pastebin/dist/index.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACzC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAI,OAAO,CAAC,2BAA2B,CAAC,CAAA;AAClD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAClC,IAAI,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAI5C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4CAA4C,CAAC;KACzD,MAAM,CAAC,GAAS,EAAE;IACjB,IAAI,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IAExD,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAC9B,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IACtB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,mHAAmH;IACnH,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;IACnB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;IAC7C,IAAI,GAAG,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,EAAE,CAA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AW,CACd,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,EACH,EAAE,EACF,CAAC,IAAS,EAAE,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAChC,CAAC,EACD,CAAC,IAAS,EAAE,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAC5B,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAChC,CAAC,EACD,CAAC,IAAS,EAAE,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;QACjC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;QAC9B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IAEH,CAAC,CACF,CAAC;IAEJ,YAAY;IAIZ,eAAe;IACf,WAAW;IACX,eAAe;IACf,qBAAqB;IACrB,wCAAwC;IACxC,qCAAqC;IAGrC,OAAO;IACP,yBAAyB;IACzB,qCAAqC;IACrC,uCAAuC;IACvC,MAAM;IACN,KAAK;AACP,CAAC,CAAA,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC"}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user