code: func Register(instance, service, domain string, port int, text []string, iface *net.Interface) (*Server, error) {
  	entry := NewServiceEntry(instance, service, domain)
  	entry.Port = port
  	entry.Text = text
  
  	if entry.Instance == "" {
  		return nil, fmt.Errorf("Missing service instance name")
  	}
  	if entry.Service == "" {
  		return nil, fmt.Errorf("Missing service name")
  	}
  	if entry.Domain == "" {
  		entry.Domain = "local"
  	}
  	if entry.Port == 0 {
  		return nil, fmt.Errorf("Missing port")
  	}
  
  	var err error
  	if entry.HostName == "" {
  		entry.HostName, err = os.Hostname()
  		if err != nil {
  			return nil, fmt.Errorf("Could not determine host")
  		}
  	}
  	entry.HostName = fmt.Sprintf("%s.", trimDot(entry.HostName))
  
  	addrs, err := net.LookupIP(entry.HostName)
  	if err != nil {
  		// Try appending the host domain suffix and lookup again
  		// (required for Linux-based hosts)
  		tmpHostName := fmt.Sprintf("%s%s.", entry.HostName, entry.Domain)
  		addrs, err = net.LookupIP(tmpHostName)
  		if err != nil {
  			return nil, fmt.Errorf("Could not determine host IP addresses for %s", entry.HostName)
  		}
  	}
  	for i := 0; i < len(addrs); i++ {
  		if ipv4 := addrs[i].To4(); ipv4 != nil {
  			entry.AddrIPv4 = addrs[i]
  		} else if ipv6 := addrs[i].To16(); ipv6 != nil {
  			entry.AddrIPv6 = addrs[i]
  		}
  	}
  
  	s, err := newServer(iface)
  	if err != nil {
  		return nil, err
  	}
  
  	s.service = entry
  	go s.mainloop()
  	go s.probe()
  
  	return s, nil
  }
docs: // Register a service by given arguments. This call will take the system's hostname
  // and lookup IP by that hostname.