{"id":25152789,"url":"https://github.com/tykuhn2/gerte-node","last_synced_at":"2026-04-13T21:32:09.070Z","repository":{"id":57250032,"uuid":"180269864","full_name":"TYKUHN2/gerte-node","owner":"TYKUHN2","description":"GERTe NodeJS Gateway","archived":false,"fork":false,"pushed_at":"2021-07-23T05:49:37.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T16:41:37.907Z","etag":null,"topics":["client","firewall","gateway","gert","gerte","javascript","library","networking","nodejs","proxy"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TYKUHN2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-09T02:34:02.000Z","updated_at":"2021-07-23T05:49:40.000Z","dependencies_parsed_at":"2022-09-09T00:50:24.420Z","dependency_job_id":null,"html_url":"https://github.com/TYKUHN2/gerte-node","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/TYKUHN2/gerte-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYKUHN2%2Fgerte-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYKUHN2%2Fgerte-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYKUHN2%2Fgerte-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYKUHN2%2Fgerte-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TYKUHN2","download_url":"https://codeload.github.com/TYKUHN2/gerte-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TYKUHN2%2Fgerte-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267633683,"owners_count":24118778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","firewall","gateway","gert","gerte","javascript","library","networking","nodejs","proxy"],"created_at":"2025-02-08T23:35:25.223Z","updated_at":"2026-04-13T21:32:09.030Z","avatar_url":"https://github.com/TYKUHN2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GERTe Gateway (NodeJS)\n*This repository is dedicated to the NodeJS version of the GERTe Gateway*  \nFor more information on GERTe or its gateways see the [main repository.](https://github.com/GlobalEmpire/GERT)\n\n## Installing\nSimply install the npm package (`npm i gerte` or other methods) and `require` it.\n\n## Usage\nThe API provided by this package has two parts: *Config* and *Connection*.\n\n### Reading Configuration\nThe API can read configuration files often distributed with GERTe gateways via the `Config` function exported by the main file.  \nTo read a configuration file, simply pass the filename into the `Config` function which will then attempt to synchronously read the file and return an array of \"peers\" it finds within the file.  \nThe peer objects have three values: `ip`, `gport`, and `pport`. For the purposes of this API, only `ip` and `gport` are needed.\n\n### Connecting to GEDS\nThe main file exports a class called `Connection` which, when constructed, connects to and negotiates with the selected GEDS server.  \nTo construct a `Connection` call `new Connection(port, ip)` where `port` is a number and `ip` is a string.\n\nThe `Connection` class has the following events: *error*, *connected*, *status*, *registered*, *data*, and *close*. Socket errors beyond `ECONNRESET`, `ECONNREFUSED`, and `ETIMEDOUT` will be emitted by the `Connection` class as well.\n\n#### Events\nMost applications will only require the *registered* and *data* events, with *close* and *error* for safety. *connected*, and *status* are not required as the internal implementation will use them.\n\n#### Registering an Address\n***This documentation assumes you already have an address from the GERT maintainers.***  \nIn order to register an address, call `Connection.register(address, key)` where address is a string with a valid GERTe dot format address and key is a valid 20-byte string.  \n*If the gateway has not finished negotiating the registration will be deferred until the negotiation is complete.*\n\nOnce registration is complete, the `Connection` object will emit a *registered* event with the address as an argument.\n\nThe current address as known by the gateway can be retrieved from `Connection.address`.  \n*Note: This address can be either an empty string if no known address is registered, `unknown` if the address is unknown due to a reported error, or a GERTe dot format address.*\n\n#### Sending Data\n*Reminder: Sending and receiving data requires being registered*  \n*Prior to sending data, ensure the* registered *event has been thrown*  \nTo send data call `Connector.send(tgt, src, data)` where tgt is a dot-colon format GERTc address, src is a dot format GERTi address, and data is either a string or a buffer.  \n***Data cannot exceed 255 bytes excluding headers***\n\nThe function will return a promise. The promise will be resolved on a positive response from GEDS or rejected with the error message on a negative response from GEDS.\n\n#### Receiving Data\n*Reminder: Sending and receiving data requires being registered*  \nWhen the API receives data from GEDS it will be parsed into an object and emitted in a *data* event.  \nThe data object has three values: `source`, `target`, `data`.  \nThe source address is a GERTc dot-colon format address from which the message was sent, the target address is a GERTc dot-colon format address to which the message is addressed, and data is a buffer of the data received.\n\n#### Closing the Connection\nWhilst NodeJS and GEDS should be able to handle practically any form of closure, a safe way to ensure the address is freed is to call `Connection.close()` and await the *close* event.  \nCalling `Connection.close()` immediately sends a close request to GEDS and shutdowns the writing functionality of the connection. The *close* event will be thrown once GEDS responds to the request.\n\n## Licensing\nThe project is currently listed as `UNLICENSED` otherwise known as \"all rights reserved.\"  \nThis has more to do with a rush to publish and less to do with restrictions on modifications. General rule: play nice.  \n*Give credit where credit is due, be willing to submit your changes to this repository, do not \"steal\" outside reasonable redistribution, etc.*\n\nOfficially all rights are reserved but if you play nice there is no reason to worry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftykuhn2%2Fgerte-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftykuhn2%2Fgerte-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftykuhn2%2Fgerte-node/lists"}