Coder Social home page Coder Social logo

Underscores in subdomains? about parse-domain HOT 5 CLOSED

tasinet avatar tasinet commented on June 9, 2024 2
Underscores in subdomains?

from parse-domain.

Comments (5)

randalpinto avatar randalpinto commented on June 9, 2024 1

i like the idea, STRICT being the default?

from parse-domain.

randalpinto avatar randalpinto commented on June 9, 2024

Ditto, _dmarc.somedomain.com is a good example of that.

from parse-domain.

jhnns avatar jhnns commented on June 9, 2024

Sure 👍

While doing a quick research, I just stumbled upon https://stackoverflow.com/a/2183140
Maybe we shouldn't validate the characters after all... what do you think?

Anyway, you can send my a PR adding _ as allowed character for now

from parse-domain.

jhnns avatar jhnns commented on June 9, 2024

I changed my mind. I'm going to allow 2 different validation modes:

export enum Validation {
  /**
   * Allows any octets as labels
   * but still restricts the length of labels and the overall domain.
   *
   * @see https://www.rfc-editor.org/rfc/rfc2181#section-11
   **/
  Lax = "LAX",

  /**
   * Only allows ASCII letters, digits and hyphens (aka LDH),
   * forbids hyphens at the the beginning or end of a label
   * and requires top-level domain names not to be all-numeric.
   *
   * This is the default if no validation is configured.
   *
   * @see https://datatracker.ietf.org/doc/html/rfc3696#section-2
   */
  Strict = "STRICT",
}

What do you think?

from parse-domain.

jhnns avatar jhnns commented on June 9, 2024

Shipped with v5.0.0 🚀

import { parseDomain, Validation } from "parse-domain";

const parseResult = parseDomain("_jabber._tcp.gmail.com", {
  validation: Validation.Lax,
});

from parse-domain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.