npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ndiinginc/proxy

v2.0.0

Published

<dl> <dt><a href="#setProxyServer">setProxyServer([address], [port], enable)</a></dt> <dd><p>Mengatur server proxy untuk Windows.</p> </dd> <dt><a href="#getProxyServer">getProxyServer()</a> ⇒ <code>string</code> | <code>null</code></dt> <dd><p>Mengambil

Downloads

3

Readme

Functions

setProxyServer([address], [port], enable)

Mengatur server proxy untuk Windows.

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat mengubah pengaturan proxy.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [address] | string | "&quot;127.0.0.1&quot;" | Alamat IP dari server proxy. | | [port] | number | 8000 | Port dari server proxy. | | enable | boolean | | Jika true, proxy diaktifkan; jika false, proxy dinonaktifkan. |

getProxyServer() ⇒ string | null

Mengambil alamat server proxy yang sedang digunakan.

Kind: global function
Returns: string | null - - Alamat server proxy dalam format "http://address:port" atau null jika tidak ada.
Throws:

  • Error - Jika terjadi kesalahan saat mengambil pengaturan proxy.

generateRootCA2() ⇒ Object

Menghasilkan CA root untuk sertifikat SSL.

Kind: global function
Returns: Object - - Objek yang berisi kunci privat dan sertifikat root.
Throws:

  • Error - Jika terjadi kesalahan saat menghasilkan atau membaca kunci dan sertifikat.

handleSNICallback(servername, cb)

Menangani callback SNI (Server Name Indication) untuk TLS.

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat menghasilkan sertifikat.

| Param | Type | Description | | --- | --- | --- | | servername | string | Nama host server yang terhubung. | | cb | function | Callback yang dipanggil dengan konteks TLS. | | cb.err | Error | null | Kesalahan jika ada, null jika tidak ada. | | cb.ctx | SecureContext | Konteks TLS yang terkait dengan servername. |

Example

const server = tls.createServer({
    SNICallback: handleSNICallback
}, (socket) => {
    // Handle socket
});
server.listen(443);

handleConnect(req, socket, head)

Menangani koneksi HTTP CONNECT untuk tunneling (misalnya, HTTPS).

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat mengatur koneksi.

| Param | Type | Description | | --- | --- | --- | | req | http.IncomingMessage | Objek permintaan HTTP. | | socket | net.Socket | Socket yang terhubung dari klien. | | head | Buffer | Bagian pertama dari data yang diterima. |

Example

const server = http.createServer(handleConnect);
server.listen(3000);

handleResponse(req, res, res2)

Menangani respons dari permintaan dan meneruskan ke respons klien.

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat mengalirkan data dari respons.

| Param | Type | Description | | --- | --- | --- | | req | http.IncomingMessage | Objek permintaan HTTP dari klien. | | res | http.ServerResponse | Objek respons HTTP yang akan dikirim ke klien. | | res2 | http.IncomingMessage | Objek respons yang diterima dari server upstream. |

Example

const server = http.createServer((req, res) => {
    const res2 = fetchUpstreamResponse(req); // Asumsi ada fungsi fetchUpstreamResponse()
    handleResponse(req, res, res2);
});
server.listen(3000);

handleRequest(req, res, head)

Menangani permintaan HTTP dan meneruskannya ke server upstream.

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat mengalirkan data atau dalam permintaan upstream.

| Param | Type | Description | | --- | --- | --- | | req | http.IncomingMessage | Objek permintaan HTTP yang diterima dari klien. | | res | http.ServerResponse | Objek respons HTTP yang akan dikirim ke klien. | | head | Buffer | Bagian pertama dari data yang diterima (digunakan untuk upgrade). |

Example

const server = http.createServer(handleRequest);
server.listen(3000);

handleUpgrade(req, socket, head, req2, socket2, head2)

Menangani upgrade koneksi HTTP (seperti WebSocket).

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat mengalirkan data atau menulis ke socket.

| Param | Type | Description | | --- | --- | --- | | req | http.IncomingMessage | Objek permintaan HTTP dari klien. | | socket | net.Socket | Socket yang terhubung dari klien. | | head | Buffer | Bagian pertama dari data yang diterima (digunakan untuk upgrade). | | req2 | http.IncomingMessage | Objek permintaan HTTP dari server upstream. | | socket2 | net.Socket | Socket yang terhubung dari server upstream. | | head2 | Buffer | Bagian pertama dari data yang diterima dari server upstream. |

start([port], [hostname], [backlog])

Memulai server HTTP dan HTTPS.

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat memulai server.

| Param | Type | Default | Description | | --- | --- | --- | --- | | [port] | number | 8000 | Port untuk server HTTP. Default adalah 8000. | | [hostname] | string | "'0.0.0.0'" | Nama host untuk server. Default adalah '0.0.0.0'. | | [backlog] | function | () => console.log(httpServer.address()) | Fungsi callback yang dipanggil setelah server mulai mendengarkan. |

Example

start(3000, 'localhost', () => {
    console.log('Server is running on http://localhost:3000');
});

stop()

Menghentikan server HTTP dan HTTPS.

Kind: global function
Throws:

  • Error - Jika terjadi kesalahan saat menghentikan server.

Example

stop();