Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: support udp and unix protocols #41

Open
lay-225 opened this issue Mar 17, 2020 · 1 comment
Open

Feature request: support udp and unix protocols #41

lay-225 opened this issue Mar 17, 2020 · 1 comment

Comments

@lay-225
Copy link

lay-225 commented Mar 17, 2020

func (mp *master) retreiveFileDescriptors() error {
	mp.slaveExtraFiles = make([]*os.File, len(mp.Config.Addresses))
	for i, addr := range mp.Config.Addresses {
		a, err := net.ResolveTCPAddr("tcp", addr)
                //a,err :=net.ResolveUnixAddr("unix",addr)
               //net.ResolveUnixAddr("udp",addr)
		if err != nil {
			return fmt.Errorf("Invalid address %s (%s)", addr, err)
		}
		l, err := net.ListenTCP("tcp", a)
		if err != nil {
			return err
		}
		f, err := l.File()
		if err != nil {
			return fmt.Errorf("Failed to retreive fd for: %s (%s)", addr, err)
		}
		if err := l.Close(); err != nil {
			return fmt.Errorf("Failed to close listener for: %s (%s)", addr, err)
		}
		mp.slaveExtraFiles[i] = f
	}
	return nil
}

like this?


edit from @jpillora: to support this and stay backwards compatible, I think we add this to the Address string:

Currently

  • :5000 is TCP 0.0.0.0:5000,
    We could also support
  • tcp::5000 which would also be TCP 0.0.0.0:5000,
  • tcp:0.0.0.0:5000 which would also be TCP 0.0.0.0:5000,
  • udp::5000 which would be UDP 0.0.0.0:5000
  • unix:/my/absolute/path/to/my/file.sock which would be a unix socket
@jpillora jpillora changed the title Whether it can support udp and unix protocols Feature request: support udp and unix protocols Mar 29, 2020
@jpillora
Copy link
Owner

Edited the description, changed to a feature request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants