1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Support proxies for PeerTube (#4346)

* Updated with latest code

* Updated Support proxies for PeerTube

* Support Proxies for PeerTube (Updated with change request)

* Cleanup proxy PR

Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
smilekison 2021-08-25 06:08:37 -07:00 committed by GitHub
parent fdec51e384
commit 8729a87024
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 191 additions and 3 deletions

View file

@ -0,0 +1,27 @@
import { createServer, Server } from 'http'
import * as proxy from 'proxy'
import { randomInt } from '@shared/core-utils'
class MockProxy {
private server: Server
initialize () {
return new Promise<number>(res => {
const port = 42501 + randomInt(1, 100)
this.server = proxy(createServer())
this.server.listen(port, () => res(port))
})
}
terminate () {
if (this.server) this.server.close()
}
}
// ---------------------------------------------------------------------------
export {
MockProxy
}