{"id":16964980,"url":"https://github.com/propensive/nettlesome","last_synced_at":"2025-03-22T14:31:00.306Z","repository":{"id":178619371,"uuid":"662126894","full_name":"propensive/nettlesome","owner":"propensive","description":"Typesafe representations of network concepts in Scala","archived":false,"fork":false,"pushed_at":"2025-02-11T23:36:19.000Z","size":4050,"stargazers_count":7,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T11:52:03.258Z","etag":null,"topics":["ip-addresses","mac-addresses","networking","ports","scala","url-parsing","urls"],"latest_commit_sha":null,"homepage":"https://soundness.dev/nettlesome/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/propensive.png","metadata":{"files":{"readme":".github/readme.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-04T12:13:39.000Z","updated_at":"2025-02-11T23:36:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"695c52cf-8b6d-4b73-a2ee-369a2115fd20","html_url":"https://github.com/propensive/nettlesome","commit_stats":null,"previous_names":["propensive/nettlesome"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fnettlesome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fnettlesome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fnettlesome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fnettlesome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propensive","download_url":"https://codeload.github.com/propensive/nettlesome/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244971774,"owners_count":20540853,"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","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":["ip-addresses","mac-addresses","networking","ports","scala","url-parsing","urls"],"created_at":"2024-10-13T23:44:45.731Z","updated_at":"2025-03-22T14:31:00.298Z","avatar_url":"https://github.com/propensive.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[\u003cimg alt=\"GitHub Workflow\" src=\"https://img.shields.io/github/actions/workflow/status/propensive/nettlesome/main.yml?style=for-the-badge\" height=\"24\"\u003e](https://github.com/propensive/nettlesome/actions)\n[\u003cimg src=\"https://img.shields.io/discord/633198088311537684?color=8899f7\u0026label=DISCORD\u0026style=for-the-badge\" height=\"24\"\u003e](https://discord.com/invite/MBUrkTgMnA)\n\u003cimg src=\"/doc/images/github.png\" valign=\"middle\"\u003e\n\n# Nettlesome\n\n__Typesafe representations of network concepts__\n\nWe need to work with a variety of different types of entity when working with\nnetworking technologies. These include URLs, IP addresses, email address and\nMAC addresses. Parsing and serializing these entities without loss of\ngenerality is typically nontrivial, and it is for this reason that __Nettlesome__\nexists.\n\n## Features\n\n- Represent URLs, MAC addresses and IP addresses with immutable datatypes\n- IPv4 addresses and MAC addresses are represented efficiently as opaque primitives\n- Compile-time parsing of URLs, MAC addresses and IP addresses with string interpolators\n- Runtime parsing and serialization, with parsing errors handled using capabilities\n\n\n## Availability\n\n\n\n\n\n\n\n## Getting Started\n\n### Entity types\n\nNettlesome is capable of representing all of the following:\n- IPv4 addresses as `Ipv4`s\n- IPv6 addresses as `Ipv6`s\n- URLs as `Url`s\n- hostnames as `Hostname`s\n- MAC addresses as `MacAddress`s\n\nEmail addresses will be added later.\n\n### IP Addresses\n\n#### Construction\n\nTo create an IP address value, either an `Ipv4` or `Ipv6`, from a known string, such as `192.168.1.12`\nor `2000:abcd:1234::5:12`, simply write it inside quotes prefixed with `ip`, like so:\n```scala\nval address1: Ipv4 = ip\"192.168.1.12\"\nval address2: Ipv6 = ip\"2000:abcd:1234::5:12\"\n```\n\nThe same `ip` interpolator is used for both types, and the return type will adapt to the content.\n\nA mistake in the content will result in a compile error, for example `ip\"192.168.1.2.3\"` will fail to\ncompile because there are five `.`-separated integers, rather than four.\n\nIn particular, for IPv4 addresses, the parser checks for,\n - exactly four groups\n - only integers in the range 0-255\n - no non-integer characters, other than `.`\n\nand for IPv6 addresses,\n - a maximum of eight `:`-separated groups\n - at most one `::` separator\n - between one and four hexadecimal characters for each group\n\n#### Parsing\n\nThe same parser can be used at runtime, throwing an `IpAddressError` in the event of an incorrect address.\n\nTo parse an IP address from a `Text` value, use the `parse` method of either the `Ipv4` or `Ipv6` objects,\nfor example,\n```scala\nval address1: Ipv4 = Ipv4.parse(t\"192.168.1.12\")\nval address2: Ipv6 = Ipv6.parse(ipAddressText)\n```\n\n#### Serializing\n\nBoth `Ipv4` and `Ipv6` addresses have `Show` instances, which will serialize\nthese addresse to `Text` values.  IPv4 addresses will be serialized,\nunsurprisingly, as four integers interspersed with `.` characters, and IPv6\naddresses will be serialized according to the\n[IETF's recommended canonical representation](https://datatracker.ietf.org/doc/html/rfc5952),\nwhich includes various simplifications.\n\n### URLs\n\n#### Construction\n\nA URL instance can be defined using the `url\"\"` interpolator, which will check\nthe URL's syntax at compiletime, reporting any parsing issues as compile errors. For example:\n```scala\nval url = url\"https://github.com/propensive/nettlesom/\"\n```\n\nIt is also possible to construct a `Url` instance directly using the various\nimmutable datatypes from which it is composed, but it's rare that this would be\npreferable.\n\n#### Parsing\n\nIf the URL is not known at compiletime, but is available at runtime as a `Text`\nstring, it can be parsed. For example,\n```scala\nval url = Url.parse(urlText)\n```\n\nIf an invalid value is passed to the `parse` method, then an error will be\nraised. If using [Contingency](https://github.com/propensive/contingency/) then\nthere are a variety of ways in which such errors can be handled.\n\n\n\n\n\n\n## Status\n\nNettlesome is classified as __maturescent__. For reference, Soundness projects are\ncategorized into one of the following five stability levels:\n\n- _embryonic_: for experimental or demonstrative purposes only, without any guarantees of longevity\n- _fledgling_: of proven utility, seeking contributions, but liable to significant redesigns\n- _maturescent_: major design decisions broady settled, seeking probatory adoption and refinement\n- _dependable_: production-ready, subject to controlled ongoing maintenance and enhancement; tagged as version `1.0.0` or later\n- _adamantine_: proven, reliable and production-ready, with no further breaking changes ever anticipated\n\nProjects at any stability level, even _embryonic_ projects, can still be used,\nas long as caution is taken to avoid a mismatch between the project's stability\nlevel and the required stability and maintainability of your own project.\n\nNettlesome is designed to be _small_. Its entire source code currently consists\nof 1160 lines of code.\n\n## Building\n\nNettlesome will ultimately be built by Fury, when it is published. In the\nmeantime, two possibilities are offered, however they are acknowledged to be\nfragile, inadequately tested, and unsuitable for anything more than\nexperimentation. They are provided only for the necessity of providing _some_\nanswer to the question, \"how can I try Nettlesome?\".\n\n1. *Copy the sources into your own project*\n   \n   Read the `fury` file in the repository root to understand Nettlesome's build\n   structure, dependencies and source location; the file format should be short\n   and quite intuitive. Copy the sources into a source directory in your own\n   project, then repeat (recursively) for each of the dependencies.\n\n   The sources are compiled against the latest nightly release of Scala 3.\n   There should be no problem to compile the project together with all of its\n   dependencies in a single compilation.\n\n2. *Build with [Wrath](https://github.com/propensive/wrath/)*\n\n   Wrath is a bootstrapping script for building Nettlesome and other projects in\n   the absence of a fully-featured build tool. It is designed to read the `fury`\n   file in the project directory, and produce a collection of JAR files which can\n   be added to a classpath, by compiling the project and all of its dependencies,\n   including the Scala compiler itself.\n   \n   Download the latest version of\n   [`wrath`](https://github.com/propensive/wrath/releases/latest), make it\n   executable, and add it to your path, for example by copying it to\n   `/usr/local/bin/`.\n\n   Clone this repository inside an empty directory, so that the build can\n   safely make clones of repositories it depends on as _peers_ of `nettlesome`.\n   Run `wrath -F` in the repository root. This will download and compile the\n   latest version of Scala, as well as all of Nettlesome's dependencies.\n\n   If the build was successful, the compiled JAR files can be found in the\n   `.wrath/dist` directory.\n\n## Contributing\n\nContributors to Nettlesome are welcome and encouraged. New contributors may like\nto look for issues marked\n[beginner](https://github.com/propensive/nettlesome/labels/beginner).\n\nWe suggest that all contributors read the [Contributing\nGuide](/contributing.md) to make the process of contributing to Nettlesome\neasier.\n\nPlease __do not__ contact project maintainers privately with questions unless\nthere is a good reason to keep them private. While it can be tempting to\nrepsond to such questions, private answers cannot be shared with a wider\naudience, and it can result in duplication of effort.\n\n## Author\n\nNettlesome was designed and developed by Jon Pretty, and commercial support and\ntraining on all aspects of Scala 3 is available from [Propensive\nO\u0026Uuml;](https://propensive.com/).\n\n\n\n## Name\n\n_Nettlesome_ provides the slightly irritating (or _nettlesome_) task of working with _network_ addresses,\nwhich it alludes to in its first three letters.\n\nIn general, Soundness project names are always chosen with some rationale,\nhowever it is usually frivolous. Each name is chosen for more for its\n_uniqueness_ and _intrigue_ than its concision or catchiness, and there is no\nbias towards names with positive or \"nice\" meanings—since many of the libraries\nperform some quite unpleasant tasks.\n\nNames should be English words, though many are obscure or archaic, and it\nshould be noted how willingly English adopts foreign words. Names are generally\nof Greek or Latin origin, and have often arrived in English via a romance\nlanguage.\n\n## Logo\n\nThe logo shows a nettle leaf.\n\n## License\n\nNettlesome is copyright \u0026copy; 2025 Jon Pretty \u0026 Propensive O\u0026Uuml;, and\nis made available under the [Apache 2.0 License](/license.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fnettlesome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropensive%2Fnettlesome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fnettlesome/lists"}