mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-24 00:48:39 +08:00
init edge tunnel
This commit is contained in:
31
apps/edge-bypass-client/src/test.mjs
Normal file
31
apps/edge-bypass-client/src/test.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as undici from 'undici';
|
||||
import { pipeline, Readable, Writable } from 'node:stream';
|
||||
|
||||
pipeline(
|
||||
new Readable({
|
||||
read() {
|
||||
this.push(Buffer.from('undici'));
|
||||
this.push(null);
|
||||
},
|
||||
}),
|
||||
undici.pipeline(
|
||||
'http://localhost:1082',
|
||||
{
|
||||
method: 'POST',
|
||||
},
|
||||
({ statusCode, headers, body }) => {
|
||||
console.log(`response received ${statusCode}`);
|
||||
console.log('headers', headers);
|
||||
console.log('headers', body);
|
||||
return body;
|
||||
}
|
||||
),
|
||||
// new Writable({
|
||||
// write(chunk) {
|
||||
// console.log(chunk.toString());
|
||||
// },
|
||||
// }),
|
||||
(error) => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user