nixos/nat: add forwardPorts for external->internal DNAT

Especially useful when you want to access services in containers from the outside directly without any proxy in the middle.
It could be cleaner from a type system perspective, but that's so
straightforward as iptables argument and I think instead it's cleaner to
write for the end user, instead of cluttering the config with other
attributes.
I will commit the type for the inner shape though.


On Wed, Sep 3, 2014 at 7:54 PM, Eelco Dolstra <notifications@github.com>
wrote:

> In nixos/modules/services/networking/nat.nix:
>
> > @@ -75,6 +75,17 @@ in
> >          '';
> >      };
> >
> > +    networking.nat.forwardPorts = mkOption {
> > +      type = types.listOf types.attrs;
> > +      default = [];
> > +      example = [ { sourcePort = 8080; destination = "10.0.0.1:80"; } ];
>
> It might be a bit cleaner to have separate destPort and destAddress
> options.
>
> Also, could you specify a type for the attributes so that users get proper
> error messages?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/NixOS/nixpkgs/pull/3926/files#r17067295>.
>



-- 
www.debian.org - The Universal Operating System