proxy_solaris.go 658 B

12345678910111213141516171819202122232425262728293031323334
  1. package portmapper
  2. import (
  3. "net"
  4. "os/exec"
  5. "strconv"
  6. )
  7. func newProxyCommand(proto string, hostIP net.IP, hostPort int, containerIP net.IP, containerPort int, proxyPath string) (userlandProxy, error) {
  8. path := proxyPath
  9. if proxyPath == "" {
  10. cmd, err := exec.LookPath(userlandProxyCommandName)
  11. if err != nil {
  12. return nil, err
  13. }
  14. path = cmd
  15. }
  16. args := []string{
  17. path,
  18. "-proto", proto,
  19. "-host-ip", hostIP.String(),
  20. "-host-port", strconv.Itoa(hostPort),
  21. "-container-ip", containerIP.String(),
  22. "-container-port", strconv.Itoa(containerPort),
  23. }
  24. return &proxyCommand{
  25. cmd: &exec.Cmd{
  26. Path: path,
  27. Args: args,
  28. },
  29. }, nil
  30. }