func NewEndpoint(serviceName string, hostPort string) (*model.Endpoint, error) {
	e := &model.Endpoint{
		ServiceName: serviceName,
	}
	if hostPort == "" || hostPort == ":0" {
		if serviceName == "" {
			return nil, nil
		}
		return e, nil
	}
	if strings.IndexByte(hostPort, ':') < 0 {
		hostPort += ":0"
	}
	host, port, err := net.SplitHostPort(hostPort)
	if err != nil {
		return nil, err
	}
	p, err := strconv.ParseUint(port, 10, 16)
	if err != nil {
		return nil, err
	}
	e.Port = uint16(p)
	addrs, err := net.LookupIP(host)
	if err != nil {
		return nil, fmt.Errorf("host lookup failure: %w", err)
	}
	for i := range addrs {
		addr := addrs[i].To4()
		if addr == nil {
			if e.IPv6 == nil {
				e.IPv6 = addrs[i].To16()
			}
		} else {
			if e.IPv4 == nil {
				e.IPv4 = addr
			}
		}
		if e.IPv4 != nil && e.IPv6 != nil {
			break
		}
	}
	return e, nil
}
NewEndpoint creates a new endpoint given the provided serviceName and
hostPort.
package zipkin
import (
	"fmt"
	"net"
	"strconv"
	"strings"
	"github.com/openzipkin/zipkin-go/model"
)