func (h TaskHost) HostURL() string {
	return netutil.ResolveURLFromServer(h.Supervisor.Server)
}
HostURL returns the listening full url (scheme+host)
based on the supervisor's server's address.
package host
import (
	"context"
	"fmt"
	"io"
	"net/http"
	"runtime"
	"time"
	"github.com/kataras/iris/core/netutil"
)
func WriteStartupLogOnServe(w io.Writer) func(TaskHost) {
	return func(h TaskHost) {
		guessScheme := netutil.ResolveScheme(h.Supervisor.manuallyTLS)
		listeningURI := netutil.ResolveURL(guessScheme, h.Supervisor.Server.Addr)
		interruptkey := "CTRL"
		if runtime.GOOS == "darwin" {
			interruptkey = "CMD"
		}
		w.Write([]byte(fmt.Sprintf("Now listening on: %s\nApplication started. Press %s+C to shut down.\n",
			listeningURI, interruptkey)))
	}
}
func ShutdownOnInterrupt(su *Supervisor, shutdownTimeout time.Duration) func() {
	return func() {
		ctx, cancel := context.WithTimeout(context.TODO(), shutdownTimeout)
		defer cancel()
		su.Shutdown(ctx)
		su.RestoreFlow()
	}
}
type TaskHost struct {
	Supervisor *Supervisor
}
func (h TaskHost) Serve() error {
	l, err := h.Supervisor.newListener()
	if err != nil {
		return err
	}
	if err := h.Supervisor.Server.Serve(l); err != http.ErrServerClosed {
		return err
	}
	return nil
}