Port forwarding is working
This commit is contained in:
		@@ -23,9 +23,9 @@ export type NatHostPort =
 | 
			
		||||
 | 
			
		||||
export interface NatEntry {
 | 
			
		||||
  protocol: "TCP" | "UDP" | "Both";
 | 
			
		||||
  host_addr: NatSource;
 | 
			
		||||
  host_ip: NatSource;
 | 
			
		||||
  host_port: NatHostPort;
 | 
			
		||||
  guest_addr: string;
 | 
			
		||||
  guest_ip: string;
 | 
			
		||||
  guest_port: number;
 | 
			
		||||
  comment?: string;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,12 +30,12 @@ export function NetNatConfiguration(p: {
 | 
			
		||||
 | 
			
		||||
  const addEntry = () => {
 | 
			
		||||
    p.nat.push({
 | 
			
		||||
      host_addr: {
 | 
			
		||||
      host_ip: {
 | 
			
		||||
        type: "ip",
 | 
			
		||||
        ip: p.version === 4 ? "10.0.0.1" : "fd00::",
 | 
			
		||||
      },
 | 
			
		||||
      host_port: { type: "single", port: 80 },
 | 
			
		||||
      guest_addr: p.version === 4 ? "10.0.0.100" : "fd00::",
 | 
			
		||||
      guest_ip: p.version === 4 ? "10.0.0.100" : "fd00::",
 | 
			
		||||
      guest_port: 10,
 | 
			
		||||
      protocol: "TCP",
 | 
			
		||||
    });
 | 
			
		||||
@@ -122,7 +122,7 @@ function NatEntryForm(p: {
 | 
			
		||||
          <NATEntryProp label="Host configuration">
 | 
			
		||||
            <SelectInput
 | 
			
		||||
              {...p}
 | 
			
		||||
              label="Host address specification"
 | 
			
		||||
              label="Host IP address specification"
 | 
			
		||||
              options={[
 | 
			
		||||
                {
 | 
			
		||||
                  label: "Specific IP",
 | 
			
		||||
@@ -136,39 +136,38 @@ function NatEntryForm(p: {
 | 
			
		||||
                    "Use active IP addresses on the selected network interface during network startup to determine host adddress",
 | 
			
		||||
                },
 | 
			
		||||
              ]}
 | 
			
		||||
              value={p.entry.host_addr.type}
 | 
			
		||||
              value={p.entry.host_ip.type}
 | 
			
		||||
              onValueChange={(v) => {
 | 
			
		||||
                p.entry.host_addr.type = v as any;
 | 
			
		||||
                p.entry.host_ip.type = v as any;
 | 
			
		||||
                p.onChange?.();
 | 
			
		||||
              }}
 | 
			
		||||
            />
 | 
			
		||||
 | 
			
		||||
            {p.entry.host_addr.type === "ip" && (
 | 
			
		||||
            {p.entry.host_ip.type === "ip" && (
 | 
			
		||||
              <IPInput
 | 
			
		||||
                {...p}
 | 
			
		||||
                label="Host IP address"
 | 
			
		||||
                value={p.entry.host_addr.ip}
 | 
			
		||||
                value={p.entry.host_ip.ip}
 | 
			
		||||
                onValueChange={(v) => {
 | 
			
		||||
                  if (p.entry.host_addr.type === "ip")
 | 
			
		||||
                    p.entry.host_addr.ip = v!;
 | 
			
		||||
                  if (p.entry.host_ip.type === "ip") p.entry.host_ip.ip = v!;
 | 
			
		||||
                  p.onChange?.();
 | 
			
		||||
                }}
 | 
			
		||||
              />
 | 
			
		||||
            )}
 | 
			
		||||
 | 
			
		||||
            {p.entry.host_addr.type === "interface" && (
 | 
			
		||||
            {p.entry.host_ip.type === "interface" && (
 | 
			
		||||
              <SelectInput
 | 
			
		||||
                {...p}
 | 
			
		||||
                label="Network interface"
 | 
			
		||||
                value={p.entry.host_addr.name}
 | 
			
		||||
                value={p.entry.host_ip.name}
 | 
			
		||||
                options={p.nicsList.map((n) => {
 | 
			
		||||
                  return {
 | 
			
		||||
                    value: n,
 | 
			
		||||
                  };
 | 
			
		||||
                })}
 | 
			
		||||
                onValueChange={(v) => {
 | 
			
		||||
                  if (p.entry.host_addr.type === "interface")
 | 
			
		||||
                    p.entry.host_addr.name = v!;
 | 
			
		||||
                  if (p.entry.host_ip.type === "interface")
 | 
			
		||||
                    p.entry.host_ip.name = v!;
 | 
			
		||||
                  p.onChange?.();
 | 
			
		||||
                }}
 | 
			
		||||
              />
 | 
			
		||||
@@ -178,10 +177,10 @@ function NatEntryForm(p: {
 | 
			
		||||
          <NATEntryProp label="Target guest configuration">
 | 
			
		||||
            <IPInput
 | 
			
		||||
              {...p}
 | 
			
		||||
              label="Guest address"
 | 
			
		||||
              value={p.entry.guest_addr}
 | 
			
		||||
              label="Guest IP"
 | 
			
		||||
              value={p.entry.guest_ip}
 | 
			
		||||
              onValueChange={(v) => {
 | 
			
		||||
                p.entry.guest_addr = v!;
 | 
			
		||||
                p.entry.guest_ip = v!;
 | 
			
		||||
                p.onChange?.();
 | 
			
		||||
              }}
 | 
			
		||||
            />
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user