Skip to content

Instantly share code, notes, and snippets.

@RIGIK93
Last active September 18, 2022 15:29
Show Gist options
  • Save RIGIK93/971fa7c194de9ece9536c73b38375a4c to your computer and use it in GitHub Desktop.
Save RIGIK93/971fa7c194de9ece9536c73b38375a4c to your computer and use it in GitHub Desktop.
subdomain-emulation

What is the idea?

I want to simulate ports on subdomains while having only one dynamic ip. This will allow to use full potential of the router.

How does it work (Draft)?

Step 1

  • Client makes a request to your custom dns.
  • Then dns gives the client ip to your router
  • dns makes a db query with user's dynamic ip (user: (user's IP) domain: (domain user wants to access (ex. darklynx.org or - - something.darklynx.org))

Step 2

Then when traffic reaches your router it goes through ngnix or some other service that'll re-translate your traffic according to json file:

  1. client reaches router and wants to access specific port
  2. ngnix looks db and finds user's ip
  3. it associates subdomain with user
  4. looks through json
{
  "darklynx.org": {
    "8080": "8080",
    "6000": "5000",
    "2556": "3000"
  },
  "something.darklynx.org": {
    "8080": "8001",
    "6000": "5001",
    "2556": "3000"
  }
}

each port here under a domain corresponds to each port on your local home server

  1. re-translates requested traffic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment