mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 07:09:12 +01:00
listen/bind -> frontend/backend (#37)
This commit is contained in:
parent
c8f48a8fe0
commit
d1e63fd8e6
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
tb "github.com/nsf/termbox-go"
|
tb "github.com/nsf/termbox-go"
|
||||||
"github.com/openziti-test-kitchen/zrok/endpoints/bind"
|
"github.com/openziti-test-kitchen/zrok/endpoints/backend"
|
||||||
"github.com/openziti-test-kitchen/zrok/model"
|
"github.com/openziti-test-kitchen/zrok/model"
|
||||||
"github.com/openziti-test-kitchen/zrok/rest_client_zrok"
|
"github.com/openziti-test-kitchen/zrok/rest_client_zrok"
|
||||||
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/tunnel"
|
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/tunnel"
|
||||||
@ -24,30 +24,31 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
httpCmd.AddCommand(newHttpBindCommand().cmd)
|
httpCmd.AddCommand(newHttpBackendCommand().cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
type httpBindCommand struct {
|
type httpBackendCommand struct {
|
||||||
service bool
|
quiet bool
|
||||||
basicAuth []string
|
basicAuth []string
|
||||||
cmd *cobra.Command
|
cmd *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
func newHttpBindCommand() *httpBindCommand {
|
func newHttpBackendCommand() *httpBackendCommand {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "bind <endpoint>",
|
Use: "backend <targetEndpoint>",
|
||||||
Short: "Create an HTTP binding",
|
Aliases: []string{"be"},
|
||||||
Args: cobra.ExactArgs(1),
|
Short: "Create an HTTP binding",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
}
|
}
|
||||||
command := &httpBindCommand{cmd: cmd}
|
command := &httpBackendCommand{cmd: cmd}
|
||||||
cmd.Flags().BoolVarP(&command.service, "service", "s", false, "Disable TUI 'chrome' for service operation")
|
cmd.Flags().BoolVarP(&command.quiet, "quiet", "q", false, "Disable TUI 'chrome' for quiet operation")
|
||||||
cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (<username:password>,...")
|
cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (<username:password>,...")
|
||||||
cmd.Run = command.run
|
cmd.Run = command.run
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *httpBindCommand) run(_ *cobra.Command, args []string) {
|
func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
|
||||||
if !self.service {
|
if !self.quiet {
|
||||||
if err := ui.Init(); err != nil {
|
if err := ui.Init(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -63,7 +64,7 @@ func (self *httpBindCommand) run(_ *cobra.Command, args []string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
cfg := &bind.Config{
|
cfg := &backend.Config{
|
||||||
IdentityPath: zif,
|
IdentityPath: zif,
|
||||||
EndpointAddress: args[0],
|
EndpointAddress: args[0],
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ func (self *httpBindCommand) run(_ *cobra.Command, args []string) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
httpProxy, err := bind.NewHTTP(cfg)
|
httpProxy, err := backend.NewHTTP(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -113,13 +114,13 @@ func (self *httpBindCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if !self.service {
|
if !self.quiet {
|
||||||
ui.Clear()
|
ui.Clear()
|
||||||
w, h := ui.TerminalDimensions()
|
w, h := ui.TerminalDimensions()
|
||||||
|
|
||||||
p := widgets.NewParagraph()
|
p := widgets.NewParagraph()
|
||||||
p.Border = true
|
p.Border = true
|
||||||
p.Title = " access your zrok service "
|
p.Title = " access your zrok quiet "
|
||||||
p.Text = fmt.Sprintf("%v%v", strings.Repeat(" ", (((w-12)-len(resp.Payload.ProxyEndpoint))/2)-1), resp.Payload.ProxyEndpoint)
|
p.Text = fmt.Sprintf("%v%v", strings.Repeat(" ", (((w-12)-len(resp.Payload.ProxyEndpoint))/2)-1), resp.Payload.ProxyEndpoint)
|
||||||
p.TextStyle = ui.Style{Fg: ui.ColorWhite}
|
p.TextStyle = ui.Style{Fg: ui.ColorWhite}
|
||||||
p.PaddingTop = 1
|
p.PaddingTop = 1
|
||||||
@ -175,13 +176,13 @@ func (self *httpBindCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for {
|
for {
|
||||||
logrus.Infof("access your zrok service: %v", resp.Payload.ProxyEndpoint)
|
logrus.Infof("access your zrok quiet: %v", resp.Payload.ProxyEndpoint)
|
||||||
time.Sleep(30 * time.Second)
|
time.Sleep(30 * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *httpBindCommand) destroy(id string, cfg *bind.Config, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) {
|
func (self *httpBackendCommand) destroy(id string, cfg *backend.Config, zrok *rest_client_zrok.Zrok, auth runtime.ClientAuthInfoWriter) {
|
||||||
logrus.Infof("shutting down '%v'", cfg.Service)
|
logrus.Infof("shutting down '%v'", cfg.Service)
|
||||||
req := tunnel.NewUntunnelParams()
|
req := tunnel.NewUntunnelParams()
|
||||||
req.Body = &rest_model_zrok.UntunnelRequest{
|
req.Body = &rest_model_zrok.UntunnelRequest{
|
41
cmd/zrok/http_frontend.go
Normal file
41
cmd/zrok/http_frontend.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/openziti-test-kitchen/zrok/endpoints/frontend"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
httpCmd.AddCommand(newHttpFrontendCommand().cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
type httpFrontendCommand struct {
|
||||||
|
endpoint string
|
||||||
|
cmd *cobra.Command
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHttpFrontendCommand() *httpFrontendCommand {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "frontend <zitiIdentity>",
|
||||||
|
Aliases: []string{"fe"},
|
||||||
|
Short: "Create an HTTP frontend",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
}
|
||||||
|
command := &httpFrontendCommand{cmd: cmd}
|
||||||
|
cmd.Flags().StringVarP(&command.endpoint, "endpoint", "e", "0.0.0.0:10180", "Bind address for HTTP frontend")
|
||||||
|
cmd.Run = command.run
|
||||||
|
return command
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *httpFrontendCommand) run(_ *cobra.Command, args []string) {
|
||||||
|
httpListener, err := frontend.NewHTTP(&frontend.Config{
|
||||||
|
IdentityPath: args[0],
|
||||||
|
Address: self.endpoint,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if err := httpListener.Run(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
@ -1,40 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/openziti-test-kitchen/zrok/endpoints/listen"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
httpCmd.AddCommand(newHttpListenCommand().cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
type httpListenCommand struct {
|
|
||||||
endpoint string
|
|
||||||
cmd *cobra.Command
|
|
||||||
}
|
|
||||||
|
|
||||||
func newHttpListenCommand() *httpListenCommand {
|
|
||||||
cmd := &cobra.Command{
|
|
||||||
Use: "listen <zitiIdentity>",
|
|
||||||
Short: "Create an HTTP listener",
|
|
||||||
Args: cobra.ExactArgs(1),
|
|
||||||
}
|
|
||||||
command := &httpListenCommand{cmd: cmd}
|
|
||||||
cmd.Flags().StringVarP(&command.endpoint, "endpoint", "e", "0.0.0.0:10111", "Address for HTTP listening endpoint")
|
|
||||||
cmd.Run = command.run
|
|
||||||
return command
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *httpListenCommand) run(_ *cobra.Command, args []string) {
|
|
||||||
httpListener, err := listen.NewHTTP(&listen.Config{
|
|
||||||
IdentityPath: args[0],
|
|
||||||
Address: self.endpoint,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if err := httpListener.Run(); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
@ -168,7 +168,7 @@ func (self *tunnelHandler) createService(name, cfgId string, edge *rest_manageme
|
|||||||
func (self *tunnelHandler) createServicePolicyBind(svcName, svcId, envId string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
func (self *tunnelHandler) createServicePolicyBind(svcName, svcId, envId string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
||||||
semantic := rest_model.SemanticAllOf
|
semantic := rest_model.SemanticAllOf
|
||||||
identityRoles := []string{fmt.Sprintf("@%v", envId)}
|
identityRoles := []string{fmt.Sprintf("@%v", envId)}
|
||||||
name := fmt.Sprintf("%v-bind", svcName)
|
name := fmt.Sprintf("%v-backend", svcName)
|
||||||
postureCheckRoles := []string{}
|
postureCheckRoles := []string{}
|
||||||
serviceRoles := []string{fmt.Sprintf("@%v", svcId)}
|
serviceRoles := []string{fmt.Sprintf("@%v", svcId)}
|
||||||
dialBind := rest_model.DialBindBind
|
dialBind := rest_model.DialBindBind
|
||||||
|
@ -173,7 +173,7 @@ func (_ *untunnelHandler) deleteServiceEdgeRouterPolicy(svcName string, edge *re
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *untunnelHandler) deleteServicePolicyBind(svcName string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
func (self *untunnelHandler) deleteServicePolicyBind(svcName string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
||||||
return self.deleteServicePolicy(fmt.Sprintf("name=\"%v-bind\"", svcName), edge)
|
return self.deleteServicePolicy(fmt.Sprintf("name=\"%v-backend\"", svcName), edge)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *untunnelHandler) deleteServicePolicyDial(svcName string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
func (self *untunnelHandler) deleteServicePolicyDial(svcName string, edge *rest_management_api_client.ZitiEdgeManagement) error {
|
||||||
|
@ -152,19 +152,19 @@ edge:
|
|||||||
|
|
||||||
# web
|
# web
|
||||||
# Defines webListeners that will be hosted by the controller. Each webListener can host many APIs and be bound to many
|
# Defines webListeners that will be hosted by the controller. Each webListener can host many APIs and be bound to many
|
||||||
# bind points.
|
# backend points.
|
||||||
web:
|
web:
|
||||||
# name - required
|
# name - required
|
||||||
# Provides a name for this listener, used for logging output. Not required to be unique, but is highly suggested.
|
# Provides a name for this listener, used for logging output. Not required to be unique, but is highly suggested.
|
||||||
- name: client-management
|
- name: client-management
|
||||||
# bindPoints - required
|
# bindPoints - required
|
||||||
# One or more bind points are required. A bind point specifies an interface (interface:port string) that defines
|
# One or more backend points are required. A backend point specifies an interface (interface:port string) that defines
|
||||||
# where on the host machine the webListener will listen and the address (host:port) that should be used to
|
# where on the host machine the webListener will frontend and the address (host:port) that should be used to
|
||||||
# publicly address the webListener(i.e. mydomain.com, localhost, 127.0.0.1). This public address may be used for
|
# publicly address the webListener(i.e. mydomain.com, localhost, 127.0.0.1). This public address may be used for
|
||||||
# incoming address resolution as well as used in responses in the API.
|
# incoming address resolution as well as used in responses in the API.
|
||||||
bindPoints:
|
bindPoints:
|
||||||
#interface - required
|
#interface - required
|
||||||
# A host:port string on which network interface to listen on. 0.0.0.0 will listen on all interfaces
|
# A host:port string on which network interface to frontend on. 0.0.0.0 will frontend on all interfaces
|
||||||
- interface: 0.0.0.0:1280
|
- interface: 0.0.0.0:1280
|
||||||
# address - required
|
# address - required
|
||||||
# The public address that external incoming requests will be able to resolve. Used in request processing and
|
# The public address that external incoming requests will be able to resolve. Used in request processing and
|
||||||
@ -206,7 +206,7 @@ web:
|
|||||||
# Allows one or more APIs to be bound to this webListener
|
# Allows one or more APIs to be bound to this webListener
|
||||||
apis:
|
apis:
|
||||||
# binding - required
|
# binding - required
|
||||||
# Specifies an API to bind to this webListener. Built-in APIs are
|
# Specifies an API to backend to this webListener. Built-in APIs are
|
||||||
# - edge-management
|
# - edge-management
|
||||||
# - edge-client
|
# - edge-client
|
||||||
# - fabric-management
|
# - fabric-management
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package bind
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openziti-test-kitchen/zrok/util"
|
"github.com/openziti-test-kitchen/zrok/util"
|
@ -1,4 +1,4 @@
|
|||||||
package listen
|
package frontend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -152,19 +152,19 @@ edge:
|
|||||||
|
|
||||||
# web
|
# web
|
||||||
# Defines webListeners that will be hosted by the controller. Each webListener can host many APIs and be bound to many
|
# Defines webListeners that will be hosted by the controller. Each webListener can host many APIs and be bound to many
|
||||||
# bind points.
|
# backend points.
|
||||||
web:
|
web:
|
||||||
# name - required
|
# name - required
|
||||||
# Provides a name for this listener, used for logging output. Not required to be unique, but is highly suggested.
|
# Provides a name for this listener, used for logging output. Not required to be unique, but is highly suggested.
|
||||||
- name: client-management
|
- name: client-management
|
||||||
# bindPoints - required
|
# bindPoints - required
|
||||||
# One or more bind points are required. A bind point specifies an interface (interface:port string) that defines
|
# One or more backend points are required. A backend point specifies an interface (interface:port string) that defines
|
||||||
# where on the host machine the webListener will listen and the address (host:port) that should be used to
|
# where on the host machine the webListener will frontend and the address (host:port) that should be used to
|
||||||
# publicly address the webListener(i.e. mydomain.com, localhost, 127.0.0.1). This public address may be used for
|
# publicly address the webListener(i.e. mydomain.com, localhost, 127.0.0.1). This public address may be used for
|
||||||
# incoming address resolution as well as used in responses in the API.
|
# incoming address resolution as well as used in responses in the API.
|
||||||
bindPoints:
|
bindPoints:
|
||||||
#interface - required
|
#interface - required
|
||||||
# A host:port string on which network interface to listen on. 0.0.0.0 will listen on all interfaces
|
# A host:port string on which network interface to frontend on. 0.0.0.0 will frontend on all interfaces
|
||||||
- interface: 0.0.0.0:1280
|
- interface: 0.0.0.0:1280
|
||||||
# address - required
|
# address - required
|
||||||
# The public address that external incoming requests will be able to resolve. Used in request processing and
|
# The public address that external incoming requests will be able to resolve. Used in request processing and
|
||||||
@ -206,7 +206,7 @@ web:
|
|||||||
# Allows one or more APIs to be bound to this webListener
|
# Allows one or more APIs to be bound to this webListener
|
||||||
apis:
|
apis:
|
||||||
# binding - required
|
# binding - required
|
||||||
# Specifies an API to bind to this webListener. Built-in APIs are
|
# Specifies an API to backend to this webListener. Built-in APIs are
|
||||||
# - edge-management
|
# - edge-management
|
||||||
# - edge-client
|
# - edge-client
|
||||||
# - fabric-management
|
# - fabric-management
|
||||||
|
@ -45,7 +45,7 @@ func (o *CreateAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
*r = *rCtx
|
*r = *rCtx
|
||||||
}
|
}
|
||||||
var Params = NewCreateAccountParams()
|
var Params = NewCreateAccountParams()
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (o *Enable) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func (o *Login) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
*r = *rCtx
|
*r = *rCtx
|
||||||
}
|
}
|
||||||
var Params = NewLoginParams()
|
var Params = NewLoginParams()
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (o *Overview) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func (o *Version) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
*r = *rCtx
|
*r = *rCtx
|
||||||
}
|
}
|
||||||
var Params = NewVersionParams()
|
var Params = NewVersionParams()
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (o *Tunnel) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (o *Untunnel) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // backend params
|
||||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -73,23 +73,23 @@ type Server struct {
|
|||||||
GracefulTimeout time.Duration `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"`
|
GracefulTimeout time.Duration `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"`
|
||||||
MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"`
|
MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"`
|
||||||
|
|
||||||
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/zrok.sock"`
|
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to frontend on" default:"/var/run/zrok.sock"`
|
||||||
domainSocketL net.Listener
|
domainSocketL net.Listener
|
||||||
|
|
||||||
Host string `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
|
Host string `long:"host" description:"the IP to frontend on" default:"localhost" env:"HOST"`
|
||||||
Port int `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"`
|
Port int `long:"port" description:"the port to frontend on for insecure connections, defaults to a random value" env:"PORT"`
|
||||||
ListenLimit int `long:"listen-limit" description:"limit the number of outstanding requests"`
|
ListenLimit int `long:"frontend-limit" description:"limit the number of outstanding requests"`
|
||||||
KeepAlive time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"`
|
KeepAlive time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"`
|
||||||
ReadTimeout time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
|
ReadTimeout time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
|
||||||
WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`
|
WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`
|
||||||
httpServerL net.Listener
|
httpServerL net.Listener
|
||||||
|
|
||||||
TLSHost string `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
|
TLSHost string `long:"tls-host" description:"the IP to frontend on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
|
||||||
TLSPort int `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"`
|
TLSPort int `long:"tls-port" description:"the port to frontend on for secure connections, defaults to a random value" env:"TLS_PORT"`
|
||||||
TLSCertificate flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
|
TLSCertificate flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
|
||||||
TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"`
|
TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"`
|
||||||
TLSCACertificate flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
|
TLSCACertificate flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
|
||||||
TLSListenLimit int `long:"tls-listen-limit" description:"limit the number of outstanding requests"`
|
TLSListenLimit int `long:"tls-frontend-limit" description:"limit the number of outstanding requests"`
|
||||||
TLSKeepAlive time.Duration `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"`
|
TLSKeepAlive time.Duration `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"`
|
||||||
TLSReadTimeout time.Duration `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
|
TLSReadTimeout time.Duration `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
|
||||||
TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
|
TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
|
||||||
@ -337,7 +337,7 @@ func (s *Server) Listen() error {
|
|||||||
if s.TLSHost == "" {
|
if s.TLSHost == "" {
|
||||||
s.TLSHost = s.Host
|
s.TLSHost = s.Host
|
||||||
}
|
}
|
||||||
// Use http listen limit if https listen limit wasn't defined
|
// Use http frontend limit if https frontend limit wasn't defined
|
||||||
if s.TLSListenLimit == 0 {
|
if s.TLSListenLimit == 0 {
|
||||||
s.TLSListenLimit = s.ListenLimit
|
s.TLSListenLimit = s.ListenLimit
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user