assh icon indicating copy to clipboard operation
assh copied to clipboard

Allow port fallback similar to gatways

Open rothgar opened this issue 9 years ago • 3 comments

For some hosts I am able to connect directly to them when I'm on my lan and need to use a non-standard port when going through the wan (firewall port mapping) It'd be nice to have something like this in my assh.yml to allow me to connect to the same host no matter where I am.

host:
    Hostname: host1
    Port:
        - 22
        - 2222

Maybe this is already possible with gateways but I haven't tested it yet and may be more confusing when setting up.

rothgar avatar Mar 14 '16 04:03 rothgar

I like the idea, but I would push it to the next level by allowing a "meta hosts" which have a full configuration fallback:

hosts:
  hosta:
    configs:
    - hosta.local
    - hosta.remote
    - hosta.gateway
  hosta.local:
    hostname: host1
    port: 22
  hosta.remote:
    hostname: host1
    port: 2222
  hosta.gateway:
    hostname: 1.2.3.4
    port: 22
    gateway: my-gateway

moul avatar Mar 14 '16 06:03 moul

I'm not sure I like all of the duplication when few thing needs to be changed but understand you don't want to have every config be a list of items to iterate through.

I could only think of Port, Gateway, and Inherits that would probably need to be lists. Other items don't usually change on the host (IdentityFile, User, etc) but met hosts would probably allow for more flexibility for all users and config options.

rothgar avatar Mar 14 '16 15:03 rothgar

Ok :)

In my opinion, a list of ports for the same host is already something not so common, that's why I wanted to create something that handle every "rare cases" with a list of hosts, so your case is natively handled as a maximum of other ones

If I found a clean way in Golang to configure the yaml parser to accept lists or strings automatically, I can consider adding the Port listing + the same thing for Hostname, for now, I need to use hard-typed fields, so it is also a lot easier for me to just add this new "Configs" list field

moul avatar Mar 14 '16 15:03 moul