diff --git a/license b/license new file mode 100644 index 0000000..40e0dda --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Task Venture Capital GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json index 28cd75d..7a4468d 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "@losslessone_private/nullresolve", "version": "1.0.31", - "description": "The nullresolve project is a private service designed to handle requests that would otherwise remain unserved, providing appropriate feedback mechanisms within the servzone architecture.", + "description": "A serve.zone fallback response service for requests that would otherwise remain unserved.", "type": "module", - "author": "Lossless GmbH", - "license": "UNLICENSED", + "author": "Task Venture Capital GmbH", + "license": "MIT", "scripts": { "test": "(tstest test/)", "start": "(node cli.js)", diff --git a/readme.md b/readme.md index f4f9b84..e95a720 100644 --- a/readme.md +++ b/readme.md @@ -1,166 +1,154 @@ -# @losslessone_private/nullresolve +# nullresolve -The nullresolve is a robust service designed to manage and handle requests effectively within the servzone architecture. It ensures requests that would normally remain unserved receive appropriate handling and feedback. +`nullresolve` is the serve.zone fallback response service for requests that reach the edge but cannot be served by an application backend, upstream origin, DNS path, or security policy. + +## Issue Reporting and Security + +For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly. + +## What It Does + +Instead of returning a raw proxy error, `nullresolve` serves clear HTML status pages through `@api.global/typedserver`'s `InfoHtml` helper. It is designed to be the last stop in a routing chain: if nothing else can answer, this service gives the client a controlled response. + +Typical uses: + +- unmatched or unassigned route fallback +- explicit status pages for blocked IPs and firewall events +- Cloudflare-style `5xx`, `1xxx`, WAF, country, attack, and Always Online status pages +- simple custom HTML info pages from query parameters + +## Package Status + +The current package name in `package.json` is still `@losslessone_private/nullresolve`, but the service belongs to the serve.zone workspace and is documented here as `nullresolve`. Do not rename the package in consuming code unless the package metadata changes. ## Install -To install the `@losslessone_private/nullresolve` package, it is essential to first set up a proper environment for handling private npm packages due to its private nature. This can be achieved through npm or yarn, which are both suitable JavaScript package managers. +In this workspace, install dependencies with pnpm and run package scripts from the repo root. -### Step-by-Step Installation: - -1. **Ensure you are logged into npm** with sufficient permissions to access private packages: - ```bash - npm login - ``` - Authentication is necessary for accessing private modules like `@losslessone_private/nullresolve`. - -2. **Install Using npm:** - ```bash - npm install @losslessone_private/nullresolve - ``` - If you are using a specific registry for your company or project, make sure to specify it in your npm configuration. - -3. **Install Using Yarn:** - ```bash - yarn add @losslessone_private/nullresolve - ``` - -After these steps, the module should be ready for use in your JavaScript or TypeScript project. - -## Usage - -The purpose of `nullresolve` is pivotal within a network ecosystem, particularly one that interfaces directly with user requests and external resources. Below, a comprehensive guide exists to demonstrate effective usage of this module within applications. - -### Quick Start Example - -Initialization and launching of a nullresolve service can be done succinctly: - -```typescript -// Import the NullResolve class from the package -import { NullResolve } from '@losslessone_private/nullresolve'; - -// Create an instance of NullResolve -const myNullResolveService = new NullResolve(); - -// Start the service -myNullResolveService.start().then(() => { - console.log('NullResolve service is running!'); -}).catch((error) => { - console.error('Error starting NullResolve service:', error); -}); - -// Stop the service gracefully -process.on('SIGINT', async () => { - await myNullResolveService.stop(); - console.log('NullResolve service stopped.'); - process.exit(0); -}); +```bash +pnpm install ``` -### Detailed Guide: Handling Requests and Custom Routes +For internal registry consumption using the current package name: -`nullresolve` can swiftly handle complex request scenarios utilizing its robust framework. Here's a detailed example of setting up custom handler routes that can respond with various HTTP statuses or custom messages based on the request: +```bash +pnpm add @losslessone_private/nullresolve +``` + +## Quick Start ```typescript import { NullResolve } from '@losslessone_private/nullresolve'; -// Initialize the service -const myService = new NullResolve(); - -// Start the service with custom routes -myService.serviceServer.addCustomRoutes(async (server) => { - server.addRoute( - '/error/:code', - new plugins.typedserver.servertools.Handler('GET', async (req, res) => { - let message; - switch (req.params.code) { - case '404': - message = 'This resource was not found.'; - break; - case '500': - message = 'Internal Server Error. Please try later.'; - break; - default: - message = 'An unexpected error occurred.'; - } - res.status(200).send(`