func (k *Kite) Port() int {
	if k.listener == nil {
		return 0
	}
	return k.listener.Addr().(*net.TCPAddr).Port
}
Port returns the TCP port number that the kite listens.
Port must be called after the listener is initialized.
You can use ServerReadyNotify function to get notified when listener is ready.

Kite starts to listen the port when Run() is called.
Since Run() is blocking you need to run it as a goroutine the call this function when listener is ready.

Example:

k := kite.New("x", "1.0.0")
go k.Run()
<-k.ServerReadyNotify()
port := k.Port()
package kite
import (
	"crypto/tls"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"os"
	"strconv"
	"strings"
	"sync"
)
func (k *Kite) Run() {
	if os.Getenv("KITE_VERSION") != "" {
		fmt.Println(k.Kite().Version)
		os.Exit(0)
	}
	const errClosing = "use of closed network connection"
	err := k.listenAndServe()
	if err != nil {
		if strings.Contains(err.Error(), errClosing) {
			k.Log.Info("Kite server is closed.")
			return
		}
		k.Log.Fatal(err.Error())
	}
}
func (k *Kite) Close() {
	k.Log.Info("Closing kite...")
	k.kontrol.Lock()
	if k.kontrol != nil && k.kontrol.Client != nil {
		k.kontrol.Close()
	}
	k.kontrol.Unlock()
	if k.listener != nil {
		k.listener.Close()
		k.listener = nil
	}
	k.mu.Lock()
	cache := k.verifyCache
	k.mu.Unlock()
	if cache != nil {
		cache.StopGC()
	}
}
func (k *Kite) Addr() string {
	return net.JoinHostPort(k.Config.IP, strconv.Itoa(k.Config.Port))
}
func (k *Kite) listenAndServe() error {
	l, err := net.Listen("tcp4", k.Addr())
	if err != nil {
		return err
	}
	k.Log.Info("New listening: %s", l.Addr())
	if k.TLSConfig != nil {
		if k.TLSConfig.NextProtos == nil {
			k.TLSConfig.NextProtos = []string{"http/1.1"}
		}
		l = tls.NewListener(l, k.TLSConfig)
	}
	k.listener = newGracefulListener(l)
	close(k.readyC)
	defer close(k.closeC)  
	k.Log.Info("Serving...")
	return k.serve(k.listener, k)
}
func (k *Kite) serve(l net.Listener, h http.Handler) error {
	if k.Config.Serve != nil {
		return k.Config.Serve(l, h)
	}
	return http.Serve(l, h)
}