Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

netget

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netget - npm Package Compare versions

Comparing version 2.3.31 to 2.3.32

knowledge_files/00_Practical_Examples.md

9

index.js

@@ -8,7 +8,4 @@ /**

// Log the successful loading of NetGet
console.log("NetGet Loaded Successfully.");
/**
* Gateway class for handling domain-based routing and server initialization.
* @see Gateway
*/
export { default as Gateway } from './src/Gateway.js';
import NetGet from './src/netget.js';
console.log("NetGet Loaded.");
export default NetGet;
{
"name": "netget",
"version": "2.3.31",
"version": "2.3.32",
"description": "Rette Adepto/ Recibido Directamente.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -8,5 +8,3 @@ <img src="https://suign.github.io/assets/imgs/netget.png" alt="netget.me" width="244" height="203">

### [Project Status : Experimental and Under Development, Subject to Major Changes]
The module is in active development, and as such, it is subject to significant changes as we refine our approach and methodologies to best support our goals.
visit: https://neurons.me to learn more.

@@ -17,3 +15,2 @@

# Unleash the Cyberspace Within
**NetGet** streamlines the orchestration of digital domains with the simplicity of a pedal's press, enabling seamless symphonies across networked realms. This **modular gateway framework,** designed for Node.js applications, acts as a dynamic conduit, **directing internet traffic to local services** with unparalleled ease. Inspired by the vast digital landscapes of cyberpunk lore, NetGet empowers developers to manage and expand their digital footprints without the complexities traditionally associated with network configurations.

@@ -24,3 +21,2 @@

## Installation
Install NetGet via npm:

@@ -33,3 +29,2 @@

## Usage
Import NetGet in your Node.js application:

@@ -53,3 +48,2 @@

## Configuration
NetGet relies on a `domains.json` file for routing configuration, structured as follows:

@@ -68,27 +62,27 @@

Each domain key maps to a handler module that exports a function to handle requests for that domain.
By default, NetGet searches for a `domains.json` configuration in the `./config` directory, streamlining the setup process.
**NetGet** is particularly useful in environments where multiple services or applications must be accessible through a single entry point, commonly known as a **reverse proxy setup.**
Scenario: Local and Remote NetGet Interaction
Local NetGet Setup: On your local machine, NetGet operates within your Node.js environment, managing local traffic and processing requests according to your configured rules. It doesn't directly face the internet and instead communicates with an external NetGet instance that does.
**NetGet** is particularly useful in environments where multiple services or applications must be accessible through a single entry point, commonly known as a **reverse proxy setup.**
Remote NetGet as a Reverse Proxy: The main.netget.me hosted on Nginx acts as your gateway to the internet. It receives internet traffic and forwards it to the appropriate local NetGet instance based on the domain routing configured.
Handshaker Mechanism: For machines not directly accessible via a public IP, the remote NetGet instance (main.netget.me) can act as a handshaker. Your local NetGet instance communicates with this handshaker, which then relays traffic between the internet and your local network.
### Scalable Web Services
In a microservices architecture, **NetGet can route requests to different services** within your infrastructure, making it an ideal solution for developers looking to scale their applications horizontally. Each service can have its own domain, and **NetGet** will ensure that requests are forwarded to the correct service.
### Personal Hosting Solutions
For personal web hosting, **NetGet** provides an **easy-to-set-up gateway** for routing traffic to various self-hosted applications. Users with several web applications running on a home server can use **NetGet** to manage access to these applications through different domains.
### Secure Access Control
Combined with authentication layers, NetGet can control access to various parts of a web infrastructure, ensuring that only authorized users can access specific services.
### Simplified Configuration
With NetGet, the complexity of setting up a domain routing system is abstracted away. Users can define their routing logic in a simple JSON configuration file, making the management of domain routes straightforward and maintainable.
### Dynamic Load Balancing
NetGet can be extended to include load balancing capabilities, distributing incoming requests across multiple instances of a service to balance the load and improve performance.

@@ -95,0 +89,0 @@

{
"name": "DefaultDomains",
"name": "DefaultDomains",
"domains": {
"cleaker.me": "cleakerHandler",
"neurons.me": "neuronsHandler"
}
"cleaker.me": {"handler": "cleakerHandler", "state": "Active"},
"neurons.me": {"handler": "neuronsHandler", "state": "Active"},
"mlearning.me": {"handler": "mlearningHandler", "state": "Maintenance"},
"mlearning.com": {"handler": "mlearningHandler", "state": "Active"},
"mlearning.studio": {"handler": "mlearningHandler", "state": "Active"},
"mdrn.me": {"handler": "mdrnHandler", "state": "Active"},
"monadlisa.me": {"handler": "monadlisaHandler", "state": "Active"},
"monadlisa.com": {"handler": "monadlisaHandler", "state": "Active"},
"netget.me": {"handler": "netgetHandler", "state": "Active"},
"orgboat.me": {"handler": "orgboatHandler", "state": "Active"}
}
}

@@ -15,3 +15,2 @@ /*

import { loadDomainConfig } from './config/domainConfigUtils.js';
// Calculate the equivalent of __dirname in ES Module scope

@@ -27,6 +26,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));

* @param {Object} config Configuration for the Gateway.
* @param {number} [config.port=3000] Port on which the server will listen.
* @param {number} [config.port=3432] Port on which the server will listen.
* @param {string} [config.domainsConfigPath='./config/domains.json'] Path to the domain configuration file.
*/
constructor({ port = 3000, domainsConfigPath = './config/domains.json' } = {}) {
constructor({ port = 3432, domainsConfigPath = './config/domains.json' } = {}) {
this.port = port;

@@ -38,3 +37,2 @@ // Adjust the path to the domains configuration file

}
/**

@@ -44,4 +42,5 @@ * Initializes the server setup including static file serving, view engine setup, and domain routing.

async initialize() {
// Calculate the base directory for the gateway, assuming the gateway class is in 'src'
const baseDir = path.dirname(fileURLToPath(import.meta.url));
const baseDir = path.dirname(fileURLToPath(import.meta.url)); // Calculate the base directory for the gateway, assuming the gateway class is in 'src'
this.app.use(express.urlencoded({ extended: true })); // Parse URL-encoded bodies (as sent by HTML forms)
this.app.use(express.json()); // Parse JSON bodies (as sent by API clients)
this.app.use(express.static(path.join(baseDir, 'ejsApp', 'public')));

@@ -52,6 +51,4 @@ this.app.set('view engine', 'ejs');

this.app.use(morgan('dev'));
// Load the domain configuration
await this.loadDomainConfig();
// Initialize and use the routes with the provided domainsConfigPath

@@ -62,3 +59,2 @@ // This should come after loading your domain configuration and before starting the server

}
/**

@@ -65,0 +61,0 @@ * Loads the domain configuration from a specified JSON file.

import express from 'express';
import fs from 'fs/promises'; // Ensure fs is imported for file operations
import { loadDomainConfig } from '../config/domainConfigUtils.js'; // Adjust the import path as necessary

@@ -23,2 +25,10 @@

// Endpoint to add a new domain
router.post('/addDomain', async (req, res) => {
console.log(req.body); // Check to see if the data is coming through
const { domain, handler, state } = req.body;
// Rest of your logic...
});
// Define other routes...

@@ -25,0 +35,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc