(rule limatype.PortForward, guest *api.IPPort)
| 47 | } |
| 48 | |
| 49 | func hostAddress(rule limatype.PortForward, guest *api.IPPort) string { |
| 50 | if rule.HostSocket != "" { |
| 51 | return rule.HostSocket |
| 52 | } |
| 53 | host := &api.IPPort{Ip: rule.HostIP.String()} |
| 54 | if guest.Port == 0 { |
| 55 | // guest is a socket |
| 56 | host.Port = int32(rule.HostPort) |
| 57 | } else { |
| 58 | host.Port = guest.Port + int32(rule.HostPortRange[0]-rule.GuestPortRange[0]) |
| 59 | } |
| 60 | return host.HostString() |
| 61 | } |
| 62 | |
| 63 | func (pf *portForwarder) forwardingAddresses(guest *api.IPPort) (hostAddr, guestAddr string) { |
| 64 | guestIP := net.ParseIP(guest.Ip) |
no test coverage detected