github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/livekit/livekit_ingress.twirp.go (about)

     1  // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.
     2  // source: livekit_ingress.proto
     3  
     4  package livekit
     5  
     6  import context "context"
     7  import fmt "fmt"
     8  import http "net/http"
     9  import io "io"
    10  import json "encoding/json"
    11  import strconv "strconv"
    12  import strings "strings"
    13  
    14  import protojson "google.golang.org/protobuf/encoding/protojson"
    15  import proto "google.golang.org/protobuf/proto"
    16  import twirp "github.com/twitchtv/twirp"
    17  import ctxsetters "github.com/twitchtv/twirp/ctxsetters"
    18  
    19  // Version compatibility assertion.
    20  // If the constant is not defined in the package, that likely means
    21  // the package needs to be updated to work with this generated code.
    22  // See https://twitchtv.github.io/twirp/docs/version_matrix.html
    23  const _ = twirp.TwirpPackageMinVersion_8_1_0
    24  
    25  // =================
    26  // Ingress Interface
    27  // =================
    28  
    29  type Ingress interface {
    30  	// Create a new Ingress
    31  	CreateIngress(context.Context, *CreateIngressRequest) (*IngressInfo, error)
    32  
    33  	// Update an existing Ingress. Ingress can only be updated when it's in ENDPOINT_WAITING state.
    34  	UpdateIngress(context.Context, *UpdateIngressRequest) (*IngressInfo, error)
    35  
    36  	ListIngress(context.Context, *ListIngressRequest) (*ListIngressResponse, error)
    37  
    38  	DeleteIngress(context.Context, *DeleteIngressRequest) (*IngressInfo, error)
    39  }
    40  
    41  // =======================
    42  // Ingress Protobuf Client
    43  // =======================
    44  
    45  type ingressProtobufClient struct {
    46  	client      HTTPClient
    47  	urls        [4]string
    48  	interceptor twirp.Interceptor
    49  	opts        twirp.ClientOptions
    50  }
    51  
    52  // NewIngressProtobufClient creates a Protobuf client that implements the Ingress interface.
    53  // It communicates using Protobuf and can be configured with a custom HTTPClient.
    54  func NewIngressProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Ingress {
    55  	if c, ok := client.(*http.Client); ok {
    56  		client = withoutRedirects(c)
    57  	}
    58  
    59  	clientOpts := twirp.ClientOptions{}
    60  	for _, o := range opts {
    61  		o(&clientOpts)
    62  	}
    63  
    64  	// Using ReadOpt allows backwards and forwards compatibility with new options in the future
    65  	literalURLs := false
    66  	_ = clientOpts.ReadOpt("literalURLs", &literalURLs)
    67  	var pathPrefix string
    68  	if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
    69  		pathPrefix = "/twirp" // default prefix
    70  	}
    71  
    72  	// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
    73  	serviceURL := sanitizeBaseURL(baseURL)
    74  	serviceURL += baseServicePath(pathPrefix, "livekit", "Ingress")
    75  	urls := [4]string{
    76  		serviceURL + "CreateIngress",
    77  		serviceURL + "UpdateIngress",
    78  		serviceURL + "ListIngress",
    79  		serviceURL + "DeleteIngress",
    80  	}
    81  
    82  	return &ingressProtobufClient{
    83  		client:      client,
    84  		urls:        urls,
    85  		interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
    86  		opts:        clientOpts,
    87  	}
    88  }
    89  
    90  func (c *ingressProtobufClient) CreateIngress(ctx context.Context, in *CreateIngressRequest) (*IngressInfo, error) {
    91  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
    92  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
    93  	ctx = ctxsetters.WithMethodName(ctx, "CreateIngress")
    94  	caller := c.callCreateIngress
    95  	if c.interceptor != nil {
    96  		caller = func(ctx context.Context, req *CreateIngressRequest) (*IngressInfo, error) {
    97  			resp, err := c.interceptor(
    98  				func(ctx context.Context, req interface{}) (interface{}, error) {
    99  					typedReq, ok := req.(*CreateIngressRequest)
   100  					if !ok {
   101  						return nil, twirp.InternalError("failed type assertion req.(*CreateIngressRequest) when calling interceptor")
   102  					}
   103  					return c.callCreateIngress(ctx, typedReq)
   104  				},
   105  			)(ctx, req)
   106  			if resp != nil {
   107  				typedResp, ok := resp.(*IngressInfo)
   108  				if !ok {
   109  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   110  				}
   111  				return typedResp, err
   112  			}
   113  			return nil, err
   114  		}
   115  	}
   116  	return caller(ctx, in)
   117  }
   118  
   119  func (c *ingressProtobufClient) callCreateIngress(ctx context.Context, in *CreateIngressRequest) (*IngressInfo, error) {
   120  	out := new(IngressInfo)
   121  	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
   122  	if err != nil {
   123  		twerr, ok := err.(twirp.Error)
   124  		if !ok {
   125  			twerr = twirp.InternalErrorWith(err)
   126  		}
   127  		callClientError(ctx, c.opts.Hooks, twerr)
   128  		return nil, err
   129  	}
   130  
   131  	callClientResponseReceived(ctx, c.opts.Hooks)
   132  
   133  	return out, nil
   134  }
   135  
   136  func (c *ingressProtobufClient) UpdateIngress(ctx context.Context, in *UpdateIngressRequest) (*IngressInfo, error) {
   137  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   138  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   139  	ctx = ctxsetters.WithMethodName(ctx, "UpdateIngress")
   140  	caller := c.callUpdateIngress
   141  	if c.interceptor != nil {
   142  		caller = func(ctx context.Context, req *UpdateIngressRequest) (*IngressInfo, error) {
   143  			resp, err := c.interceptor(
   144  				func(ctx context.Context, req interface{}) (interface{}, error) {
   145  					typedReq, ok := req.(*UpdateIngressRequest)
   146  					if !ok {
   147  						return nil, twirp.InternalError("failed type assertion req.(*UpdateIngressRequest) when calling interceptor")
   148  					}
   149  					return c.callUpdateIngress(ctx, typedReq)
   150  				},
   151  			)(ctx, req)
   152  			if resp != nil {
   153  				typedResp, ok := resp.(*IngressInfo)
   154  				if !ok {
   155  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   156  				}
   157  				return typedResp, err
   158  			}
   159  			return nil, err
   160  		}
   161  	}
   162  	return caller(ctx, in)
   163  }
   164  
   165  func (c *ingressProtobufClient) callUpdateIngress(ctx context.Context, in *UpdateIngressRequest) (*IngressInfo, error) {
   166  	out := new(IngressInfo)
   167  	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
   168  	if err != nil {
   169  		twerr, ok := err.(twirp.Error)
   170  		if !ok {
   171  			twerr = twirp.InternalErrorWith(err)
   172  		}
   173  		callClientError(ctx, c.opts.Hooks, twerr)
   174  		return nil, err
   175  	}
   176  
   177  	callClientResponseReceived(ctx, c.opts.Hooks)
   178  
   179  	return out, nil
   180  }
   181  
   182  func (c *ingressProtobufClient) ListIngress(ctx context.Context, in *ListIngressRequest) (*ListIngressResponse, error) {
   183  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   184  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   185  	ctx = ctxsetters.WithMethodName(ctx, "ListIngress")
   186  	caller := c.callListIngress
   187  	if c.interceptor != nil {
   188  		caller = func(ctx context.Context, req *ListIngressRequest) (*ListIngressResponse, error) {
   189  			resp, err := c.interceptor(
   190  				func(ctx context.Context, req interface{}) (interface{}, error) {
   191  					typedReq, ok := req.(*ListIngressRequest)
   192  					if !ok {
   193  						return nil, twirp.InternalError("failed type assertion req.(*ListIngressRequest) when calling interceptor")
   194  					}
   195  					return c.callListIngress(ctx, typedReq)
   196  				},
   197  			)(ctx, req)
   198  			if resp != nil {
   199  				typedResp, ok := resp.(*ListIngressResponse)
   200  				if !ok {
   201  					return nil, twirp.InternalError("failed type assertion resp.(*ListIngressResponse) when calling interceptor")
   202  				}
   203  				return typedResp, err
   204  			}
   205  			return nil, err
   206  		}
   207  	}
   208  	return caller(ctx, in)
   209  }
   210  
   211  func (c *ingressProtobufClient) callListIngress(ctx context.Context, in *ListIngressRequest) (*ListIngressResponse, error) {
   212  	out := new(ListIngressResponse)
   213  	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out)
   214  	if err != nil {
   215  		twerr, ok := err.(twirp.Error)
   216  		if !ok {
   217  			twerr = twirp.InternalErrorWith(err)
   218  		}
   219  		callClientError(ctx, c.opts.Hooks, twerr)
   220  		return nil, err
   221  	}
   222  
   223  	callClientResponseReceived(ctx, c.opts.Hooks)
   224  
   225  	return out, nil
   226  }
   227  
   228  func (c *ingressProtobufClient) DeleteIngress(ctx context.Context, in *DeleteIngressRequest) (*IngressInfo, error) {
   229  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   230  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   231  	ctx = ctxsetters.WithMethodName(ctx, "DeleteIngress")
   232  	caller := c.callDeleteIngress
   233  	if c.interceptor != nil {
   234  		caller = func(ctx context.Context, req *DeleteIngressRequest) (*IngressInfo, error) {
   235  			resp, err := c.interceptor(
   236  				func(ctx context.Context, req interface{}) (interface{}, error) {
   237  					typedReq, ok := req.(*DeleteIngressRequest)
   238  					if !ok {
   239  						return nil, twirp.InternalError("failed type assertion req.(*DeleteIngressRequest) when calling interceptor")
   240  					}
   241  					return c.callDeleteIngress(ctx, typedReq)
   242  				},
   243  			)(ctx, req)
   244  			if resp != nil {
   245  				typedResp, ok := resp.(*IngressInfo)
   246  				if !ok {
   247  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   248  				}
   249  				return typedResp, err
   250  			}
   251  			return nil, err
   252  		}
   253  	}
   254  	return caller(ctx, in)
   255  }
   256  
   257  func (c *ingressProtobufClient) callDeleteIngress(ctx context.Context, in *DeleteIngressRequest) (*IngressInfo, error) {
   258  	out := new(IngressInfo)
   259  	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out)
   260  	if err != nil {
   261  		twerr, ok := err.(twirp.Error)
   262  		if !ok {
   263  			twerr = twirp.InternalErrorWith(err)
   264  		}
   265  		callClientError(ctx, c.opts.Hooks, twerr)
   266  		return nil, err
   267  	}
   268  
   269  	callClientResponseReceived(ctx, c.opts.Hooks)
   270  
   271  	return out, nil
   272  }
   273  
   274  // ===================
   275  // Ingress JSON Client
   276  // ===================
   277  
   278  type ingressJSONClient struct {
   279  	client      HTTPClient
   280  	urls        [4]string
   281  	interceptor twirp.Interceptor
   282  	opts        twirp.ClientOptions
   283  }
   284  
   285  // NewIngressJSONClient creates a JSON client that implements the Ingress interface.
   286  // It communicates using JSON and can be configured with a custom HTTPClient.
   287  func NewIngressJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Ingress {
   288  	if c, ok := client.(*http.Client); ok {
   289  		client = withoutRedirects(c)
   290  	}
   291  
   292  	clientOpts := twirp.ClientOptions{}
   293  	for _, o := range opts {
   294  		o(&clientOpts)
   295  	}
   296  
   297  	// Using ReadOpt allows backwards and forwards compatibility with new options in the future
   298  	literalURLs := false
   299  	_ = clientOpts.ReadOpt("literalURLs", &literalURLs)
   300  	var pathPrefix string
   301  	if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
   302  		pathPrefix = "/twirp" // default prefix
   303  	}
   304  
   305  	// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
   306  	serviceURL := sanitizeBaseURL(baseURL)
   307  	serviceURL += baseServicePath(pathPrefix, "livekit", "Ingress")
   308  	urls := [4]string{
   309  		serviceURL + "CreateIngress",
   310  		serviceURL + "UpdateIngress",
   311  		serviceURL + "ListIngress",
   312  		serviceURL + "DeleteIngress",
   313  	}
   314  
   315  	return &ingressJSONClient{
   316  		client:      client,
   317  		urls:        urls,
   318  		interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
   319  		opts:        clientOpts,
   320  	}
   321  }
   322  
   323  func (c *ingressJSONClient) CreateIngress(ctx context.Context, in *CreateIngressRequest) (*IngressInfo, error) {
   324  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   325  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   326  	ctx = ctxsetters.WithMethodName(ctx, "CreateIngress")
   327  	caller := c.callCreateIngress
   328  	if c.interceptor != nil {
   329  		caller = func(ctx context.Context, req *CreateIngressRequest) (*IngressInfo, error) {
   330  			resp, err := c.interceptor(
   331  				func(ctx context.Context, req interface{}) (interface{}, error) {
   332  					typedReq, ok := req.(*CreateIngressRequest)
   333  					if !ok {
   334  						return nil, twirp.InternalError("failed type assertion req.(*CreateIngressRequest) when calling interceptor")
   335  					}
   336  					return c.callCreateIngress(ctx, typedReq)
   337  				},
   338  			)(ctx, req)
   339  			if resp != nil {
   340  				typedResp, ok := resp.(*IngressInfo)
   341  				if !ok {
   342  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   343  				}
   344  				return typedResp, err
   345  			}
   346  			return nil, err
   347  		}
   348  	}
   349  	return caller(ctx, in)
   350  }
   351  
   352  func (c *ingressJSONClient) callCreateIngress(ctx context.Context, in *CreateIngressRequest) (*IngressInfo, error) {
   353  	out := new(IngressInfo)
   354  	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
   355  	if err != nil {
   356  		twerr, ok := err.(twirp.Error)
   357  		if !ok {
   358  			twerr = twirp.InternalErrorWith(err)
   359  		}
   360  		callClientError(ctx, c.opts.Hooks, twerr)
   361  		return nil, err
   362  	}
   363  
   364  	callClientResponseReceived(ctx, c.opts.Hooks)
   365  
   366  	return out, nil
   367  }
   368  
   369  func (c *ingressJSONClient) UpdateIngress(ctx context.Context, in *UpdateIngressRequest) (*IngressInfo, error) {
   370  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   371  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   372  	ctx = ctxsetters.WithMethodName(ctx, "UpdateIngress")
   373  	caller := c.callUpdateIngress
   374  	if c.interceptor != nil {
   375  		caller = func(ctx context.Context, req *UpdateIngressRequest) (*IngressInfo, error) {
   376  			resp, err := c.interceptor(
   377  				func(ctx context.Context, req interface{}) (interface{}, error) {
   378  					typedReq, ok := req.(*UpdateIngressRequest)
   379  					if !ok {
   380  						return nil, twirp.InternalError("failed type assertion req.(*UpdateIngressRequest) when calling interceptor")
   381  					}
   382  					return c.callUpdateIngress(ctx, typedReq)
   383  				},
   384  			)(ctx, req)
   385  			if resp != nil {
   386  				typedResp, ok := resp.(*IngressInfo)
   387  				if !ok {
   388  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   389  				}
   390  				return typedResp, err
   391  			}
   392  			return nil, err
   393  		}
   394  	}
   395  	return caller(ctx, in)
   396  }
   397  
   398  func (c *ingressJSONClient) callUpdateIngress(ctx context.Context, in *UpdateIngressRequest) (*IngressInfo, error) {
   399  	out := new(IngressInfo)
   400  	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
   401  	if err != nil {
   402  		twerr, ok := err.(twirp.Error)
   403  		if !ok {
   404  			twerr = twirp.InternalErrorWith(err)
   405  		}
   406  		callClientError(ctx, c.opts.Hooks, twerr)
   407  		return nil, err
   408  	}
   409  
   410  	callClientResponseReceived(ctx, c.opts.Hooks)
   411  
   412  	return out, nil
   413  }
   414  
   415  func (c *ingressJSONClient) ListIngress(ctx context.Context, in *ListIngressRequest) (*ListIngressResponse, error) {
   416  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   417  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   418  	ctx = ctxsetters.WithMethodName(ctx, "ListIngress")
   419  	caller := c.callListIngress
   420  	if c.interceptor != nil {
   421  		caller = func(ctx context.Context, req *ListIngressRequest) (*ListIngressResponse, error) {
   422  			resp, err := c.interceptor(
   423  				func(ctx context.Context, req interface{}) (interface{}, error) {
   424  					typedReq, ok := req.(*ListIngressRequest)
   425  					if !ok {
   426  						return nil, twirp.InternalError("failed type assertion req.(*ListIngressRequest) when calling interceptor")
   427  					}
   428  					return c.callListIngress(ctx, typedReq)
   429  				},
   430  			)(ctx, req)
   431  			if resp != nil {
   432  				typedResp, ok := resp.(*ListIngressResponse)
   433  				if !ok {
   434  					return nil, twirp.InternalError("failed type assertion resp.(*ListIngressResponse) when calling interceptor")
   435  				}
   436  				return typedResp, err
   437  			}
   438  			return nil, err
   439  		}
   440  	}
   441  	return caller(ctx, in)
   442  }
   443  
   444  func (c *ingressJSONClient) callListIngress(ctx context.Context, in *ListIngressRequest) (*ListIngressResponse, error) {
   445  	out := new(ListIngressResponse)
   446  	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out)
   447  	if err != nil {
   448  		twerr, ok := err.(twirp.Error)
   449  		if !ok {
   450  			twerr = twirp.InternalErrorWith(err)
   451  		}
   452  		callClientError(ctx, c.opts.Hooks, twerr)
   453  		return nil, err
   454  	}
   455  
   456  	callClientResponseReceived(ctx, c.opts.Hooks)
   457  
   458  	return out, nil
   459  }
   460  
   461  func (c *ingressJSONClient) DeleteIngress(ctx context.Context, in *DeleteIngressRequest) (*IngressInfo, error) {
   462  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   463  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   464  	ctx = ctxsetters.WithMethodName(ctx, "DeleteIngress")
   465  	caller := c.callDeleteIngress
   466  	if c.interceptor != nil {
   467  		caller = func(ctx context.Context, req *DeleteIngressRequest) (*IngressInfo, error) {
   468  			resp, err := c.interceptor(
   469  				func(ctx context.Context, req interface{}) (interface{}, error) {
   470  					typedReq, ok := req.(*DeleteIngressRequest)
   471  					if !ok {
   472  						return nil, twirp.InternalError("failed type assertion req.(*DeleteIngressRequest) when calling interceptor")
   473  					}
   474  					return c.callDeleteIngress(ctx, typedReq)
   475  				},
   476  			)(ctx, req)
   477  			if resp != nil {
   478  				typedResp, ok := resp.(*IngressInfo)
   479  				if !ok {
   480  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   481  				}
   482  				return typedResp, err
   483  			}
   484  			return nil, err
   485  		}
   486  	}
   487  	return caller(ctx, in)
   488  }
   489  
   490  func (c *ingressJSONClient) callDeleteIngress(ctx context.Context, in *DeleteIngressRequest) (*IngressInfo, error) {
   491  	out := new(IngressInfo)
   492  	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out)
   493  	if err != nil {
   494  		twerr, ok := err.(twirp.Error)
   495  		if !ok {
   496  			twerr = twirp.InternalErrorWith(err)
   497  		}
   498  		callClientError(ctx, c.opts.Hooks, twerr)
   499  		return nil, err
   500  	}
   501  
   502  	callClientResponseReceived(ctx, c.opts.Hooks)
   503  
   504  	return out, nil
   505  }
   506  
   507  // ======================
   508  // Ingress Server Handler
   509  // ======================
   510  
   511  type ingressServer struct {
   512  	Ingress
   513  	interceptor      twirp.Interceptor
   514  	hooks            *twirp.ServerHooks
   515  	pathPrefix       string // prefix for routing
   516  	jsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response
   517  	jsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names
   518  }
   519  
   520  // NewIngressServer builds a TwirpServer that can be used as an http.Handler to handle
   521  // HTTP requests that are routed to the right method in the provided svc implementation.
   522  // The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).
   523  func NewIngressServer(svc Ingress, opts ...interface{}) TwirpServer {
   524  	serverOpts := newServerOpts(opts)
   525  
   526  	// Using ReadOpt allows backwards and forwards compatibility with new options in the future
   527  	jsonSkipDefaults := false
   528  	_ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults)
   529  	jsonCamelCase := false
   530  	_ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase)
   531  	var pathPrefix string
   532  	if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
   533  		pathPrefix = "/twirp" // default prefix
   534  	}
   535  
   536  	return &ingressServer{
   537  		Ingress:          svc,
   538  		hooks:            serverOpts.Hooks,
   539  		interceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),
   540  		pathPrefix:       pathPrefix,
   541  		jsonSkipDefaults: jsonSkipDefaults,
   542  		jsonCamelCase:    jsonCamelCase,
   543  	}
   544  }
   545  
   546  // writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.
   547  // If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
   548  func (s *ingressServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {
   549  	writeError(ctx, resp, err, s.hooks)
   550  }
   551  
   552  // handleRequestBodyError is used to handle error when the twirp server cannot read request
   553  func (s *ingressServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {
   554  	if context.Canceled == ctx.Err() {
   555  		s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled"))
   556  		return
   557  	}
   558  	if context.DeadlineExceeded == ctx.Err() {
   559  		s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded"))
   560  		return
   561  	}
   562  	s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))
   563  }
   564  
   565  // IngressPathPrefix is a convenience constant that may identify URL paths.
   566  // Should be used with caution, it only matches routes generated by Twirp Go clients,
   567  // with the default "/twirp" prefix and default CamelCase service and method names.
   568  // More info: https://twitchtv.github.io/twirp/docs/routing.html
   569  const IngressPathPrefix = "/twirp/livekit.Ingress/"
   570  
   571  func (s *ingressServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
   572  	ctx := req.Context()
   573  	ctx = ctxsetters.WithPackageName(ctx, "livekit")
   574  	ctx = ctxsetters.WithServiceName(ctx, "Ingress")
   575  	ctx = ctxsetters.WithResponseWriter(ctx, resp)
   576  
   577  	var err error
   578  	ctx, err = callRequestReceived(ctx, s.hooks)
   579  	if err != nil {
   580  		s.writeError(ctx, resp, err)
   581  		return
   582  	}
   583  
   584  	if req.Method != "POST" {
   585  		msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method)
   586  		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
   587  		return
   588  	}
   589  
   590  	// Verify path format: [<prefix>]/<package>.<Service>/<Method>
   591  	prefix, pkgService, method := parseTwirpPath(req.URL.Path)
   592  	if pkgService != "livekit.Ingress" {
   593  		msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
   594  		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
   595  		return
   596  	}
   597  	if prefix != s.pathPrefix {
   598  		msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path)
   599  		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
   600  		return
   601  	}
   602  
   603  	switch method {
   604  	case "CreateIngress":
   605  		s.serveCreateIngress(ctx, resp, req)
   606  		return
   607  	case "UpdateIngress":
   608  		s.serveUpdateIngress(ctx, resp, req)
   609  		return
   610  	case "ListIngress":
   611  		s.serveListIngress(ctx, resp, req)
   612  		return
   613  	case "DeleteIngress":
   614  		s.serveDeleteIngress(ctx, resp, req)
   615  		return
   616  	default:
   617  		msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
   618  		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
   619  		return
   620  	}
   621  }
   622  
   623  func (s *ingressServer) serveCreateIngress(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   624  	header := req.Header.Get("Content-Type")
   625  	i := strings.Index(header, ";")
   626  	if i == -1 {
   627  		i = len(header)
   628  	}
   629  	switch strings.TrimSpace(strings.ToLower(header[:i])) {
   630  	case "application/json":
   631  		s.serveCreateIngressJSON(ctx, resp, req)
   632  	case "application/protobuf":
   633  		s.serveCreateIngressProtobuf(ctx, resp, req)
   634  	default:
   635  		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
   636  		twerr := badRouteError(msg, req.Method, req.URL.Path)
   637  		s.writeError(ctx, resp, twerr)
   638  	}
   639  }
   640  
   641  func (s *ingressServer) serveCreateIngressJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   642  	var err error
   643  	ctx = ctxsetters.WithMethodName(ctx, "CreateIngress")
   644  	ctx, err = callRequestRouted(ctx, s.hooks)
   645  	if err != nil {
   646  		s.writeError(ctx, resp, err)
   647  		return
   648  	}
   649  
   650  	d := json.NewDecoder(req.Body)
   651  	rawReqBody := json.RawMessage{}
   652  	if err := d.Decode(&rawReqBody); err != nil {
   653  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
   654  		return
   655  	}
   656  	reqContent := new(CreateIngressRequest)
   657  	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
   658  	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
   659  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
   660  		return
   661  	}
   662  
   663  	handler := s.Ingress.CreateIngress
   664  	if s.interceptor != nil {
   665  		handler = func(ctx context.Context, req *CreateIngressRequest) (*IngressInfo, error) {
   666  			resp, err := s.interceptor(
   667  				func(ctx context.Context, req interface{}) (interface{}, error) {
   668  					typedReq, ok := req.(*CreateIngressRequest)
   669  					if !ok {
   670  						return nil, twirp.InternalError("failed type assertion req.(*CreateIngressRequest) when calling interceptor")
   671  					}
   672  					return s.Ingress.CreateIngress(ctx, typedReq)
   673  				},
   674  			)(ctx, req)
   675  			if resp != nil {
   676  				typedResp, ok := resp.(*IngressInfo)
   677  				if !ok {
   678  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   679  				}
   680  				return typedResp, err
   681  			}
   682  			return nil, err
   683  		}
   684  	}
   685  
   686  	// Call service method
   687  	var respContent *IngressInfo
   688  	func() {
   689  		defer ensurePanicResponses(ctx, resp, s.hooks)
   690  		respContent, err = handler(ctx, reqContent)
   691  	}()
   692  
   693  	if err != nil {
   694  		s.writeError(ctx, resp, err)
   695  		return
   696  	}
   697  	if respContent == nil {
   698  		s.writeError(ctx, resp, twirp.InternalError("received a nil *IngressInfo and nil error while calling CreateIngress. nil responses are not supported"))
   699  		return
   700  	}
   701  
   702  	ctx = callResponsePrepared(ctx, s.hooks)
   703  
   704  	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
   705  	respBytes, err := marshaler.Marshal(respContent)
   706  	if err != nil {
   707  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
   708  		return
   709  	}
   710  
   711  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
   712  	resp.Header().Set("Content-Type", "application/json")
   713  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
   714  	resp.WriteHeader(http.StatusOK)
   715  
   716  	if n, err := resp.Write(respBytes); err != nil {
   717  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
   718  		twerr := twirp.NewError(twirp.Unknown, msg)
   719  		ctx = callError(ctx, s.hooks, twerr)
   720  	}
   721  	callResponseSent(ctx, s.hooks)
   722  }
   723  
   724  func (s *ingressServer) serveCreateIngressProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   725  	var err error
   726  	ctx = ctxsetters.WithMethodName(ctx, "CreateIngress")
   727  	ctx, err = callRequestRouted(ctx, s.hooks)
   728  	if err != nil {
   729  		s.writeError(ctx, resp, err)
   730  		return
   731  	}
   732  
   733  	buf, err := io.ReadAll(req.Body)
   734  	if err != nil {
   735  		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
   736  		return
   737  	}
   738  	reqContent := new(CreateIngressRequest)
   739  	if err = proto.Unmarshal(buf, reqContent); err != nil {
   740  		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
   741  		return
   742  	}
   743  
   744  	handler := s.Ingress.CreateIngress
   745  	if s.interceptor != nil {
   746  		handler = func(ctx context.Context, req *CreateIngressRequest) (*IngressInfo, error) {
   747  			resp, err := s.interceptor(
   748  				func(ctx context.Context, req interface{}) (interface{}, error) {
   749  					typedReq, ok := req.(*CreateIngressRequest)
   750  					if !ok {
   751  						return nil, twirp.InternalError("failed type assertion req.(*CreateIngressRequest) when calling interceptor")
   752  					}
   753  					return s.Ingress.CreateIngress(ctx, typedReq)
   754  				},
   755  			)(ctx, req)
   756  			if resp != nil {
   757  				typedResp, ok := resp.(*IngressInfo)
   758  				if !ok {
   759  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   760  				}
   761  				return typedResp, err
   762  			}
   763  			return nil, err
   764  		}
   765  	}
   766  
   767  	// Call service method
   768  	var respContent *IngressInfo
   769  	func() {
   770  		defer ensurePanicResponses(ctx, resp, s.hooks)
   771  		respContent, err = handler(ctx, reqContent)
   772  	}()
   773  
   774  	if err != nil {
   775  		s.writeError(ctx, resp, err)
   776  		return
   777  	}
   778  	if respContent == nil {
   779  		s.writeError(ctx, resp, twirp.InternalError("received a nil *IngressInfo and nil error while calling CreateIngress. nil responses are not supported"))
   780  		return
   781  	}
   782  
   783  	ctx = callResponsePrepared(ctx, s.hooks)
   784  
   785  	respBytes, err := proto.Marshal(respContent)
   786  	if err != nil {
   787  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
   788  		return
   789  	}
   790  
   791  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
   792  	resp.Header().Set("Content-Type", "application/protobuf")
   793  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
   794  	resp.WriteHeader(http.StatusOK)
   795  	if n, err := resp.Write(respBytes); err != nil {
   796  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
   797  		twerr := twirp.NewError(twirp.Unknown, msg)
   798  		ctx = callError(ctx, s.hooks, twerr)
   799  	}
   800  	callResponseSent(ctx, s.hooks)
   801  }
   802  
   803  func (s *ingressServer) serveUpdateIngress(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   804  	header := req.Header.Get("Content-Type")
   805  	i := strings.Index(header, ";")
   806  	if i == -1 {
   807  		i = len(header)
   808  	}
   809  	switch strings.TrimSpace(strings.ToLower(header[:i])) {
   810  	case "application/json":
   811  		s.serveUpdateIngressJSON(ctx, resp, req)
   812  	case "application/protobuf":
   813  		s.serveUpdateIngressProtobuf(ctx, resp, req)
   814  	default:
   815  		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
   816  		twerr := badRouteError(msg, req.Method, req.URL.Path)
   817  		s.writeError(ctx, resp, twerr)
   818  	}
   819  }
   820  
   821  func (s *ingressServer) serveUpdateIngressJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   822  	var err error
   823  	ctx = ctxsetters.WithMethodName(ctx, "UpdateIngress")
   824  	ctx, err = callRequestRouted(ctx, s.hooks)
   825  	if err != nil {
   826  		s.writeError(ctx, resp, err)
   827  		return
   828  	}
   829  
   830  	d := json.NewDecoder(req.Body)
   831  	rawReqBody := json.RawMessage{}
   832  	if err := d.Decode(&rawReqBody); err != nil {
   833  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
   834  		return
   835  	}
   836  	reqContent := new(UpdateIngressRequest)
   837  	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
   838  	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
   839  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
   840  		return
   841  	}
   842  
   843  	handler := s.Ingress.UpdateIngress
   844  	if s.interceptor != nil {
   845  		handler = func(ctx context.Context, req *UpdateIngressRequest) (*IngressInfo, error) {
   846  			resp, err := s.interceptor(
   847  				func(ctx context.Context, req interface{}) (interface{}, error) {
   848  					typedReq, ok := req.(*UpdateIngressRequest)
   849  					if !ok {
   850  						return nil, twirp.InternalError("failed type assertion req.(*UpdateIngressRequest) when calling interceptor")
   851  					}
   852  					return s.Ingress.UpdateIngress(ctx, typedReq)
   853  				},
   854  			)(ctx, req)
   855  			if resp != nil {
   856  				typedResp, ok := resp.(*IngressInfo)
   857  				if !ok {
   858  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   859  				}
   860  				return typedResp, err
   861  			}
   862  			return nil, err
   863  		}
   864  	}
   865  
   866  	// Call service method
   867  	var respContent *IngressInfo
   868  	func() {
   869  		defer ensurePanicResponses(ctx, resp, s.hooks)
   870  		respContent, err = handler(ctx, reqContent)
   871  	}()
   872  
   873  	if err != nil {
   874  		s.writeError(ctx, resp, err)
   875  		return
   876  	}
   877  	if respContent == nil {
   878  		s.writeError(ctx, resp, twirp.InternalError("received a nil *IngressInfo and nil error while calling UpdateIngress. nil responses are not supported"))
   879  		return
   880  	}
   881  
   882  	ctx = callResponsePrepared(ctx, s.hooks)
   883  
   884  	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
   885  	respBytes, err := marshaler.Marshal(respContent)
   886  	if err != nil {
   887  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
   888  		return
   889  	}
   890  
   891  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
   892  	resp.Header().Set("Content-Type", "application/json")
   893  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
   894  	resp.WriteHeader(http.StatusOK)
   895  
   896  	if n, err := resp.Write(respBytes); err != nil {
   897  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
   898  		twerr := twirp.NewError(twirp.Unknown, msg)
   899  		ctx = callError(ctx, s.hooks, twerr)
   900  	}
   901  	callResponseSent(ctx, s.hooks)
   902  }
   903  
   904  func (s *ingressServer) serveUpdateIngressProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   905  	var err error
   906  	ctx = ctxsetters.WithMethodName(ctx, "UpdateIngress")
   907  	ctx, err = callRequestRouted(ctx, s.hooks)
   908  	if err != nil {
   909  		s.writeError(ctx, resp, err)
   910  		return
   911  	}
   912  
   913  	buf, err := io.ReadAll(req.Body)
   914  	if err != nil {
   915  		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
   916  		return
   917  	}
   918  	reqContent := new(UpdateIngressRequest)
   919  	if err = proto.Unmarshal(buf, reqContent); err != nil {
   920  		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
   921  		return
   922  	}
   923  
   924  	handler := s.Ingress.UpdateIngress
   925  	if s.interceptor != nil {
   926  		handler = func(ctx context.Context, req *UpdateIngressRequest) (*IngressInfo, error) {
   927  			resp, err := s.interceptor(
   928  				func(ctx context.Context, req interface{}) (interface{}, error) {
   929  					typedReq, ok := req.(*UpdateIngressRequest)
   930  					if !ok {
   931  						return nil, twirp.InternalError("failed type assertion req.(*UpdateIngressRequest) when calling interceptor")
   932  					}
   933  					return s.Ingress.UpdateIngress(ctx, typedReq)
   934  				},
   935  			)(ctx, req)
   936  			if resp != nil {
   937  				typedResp, ok := resp.(*IngressInfo)
   938  				if !ok {
   939  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
   940  				}
   941  				return typedResp, err
   942  			}
   943  			return nil, err
   944  		}
   945  	}
   946  
   947  	// Call service method
   948  	var respContent *IngressInfo
   949  	func() {
   950  		defer ensurePanicResponses(ctx, resp, s.hooks)
   951  		respContent, err = handler(ctx, reqContent)
   952  	}()
   953  
   954  	if err != nil {
   955  		s.writeError(ctx, resp, err)
   956  		return
   957  	}
   958  	if respContent == nil {
   959  		s.writeError(ctx, resp, twirp.InternalError("received a nil *IngressInfo and nil error while calling UpdateIngress. nil responses are not supported"))
   960  		return
   961  	}
   962  
   963  	ctx = callResponsePrepared(ctx, s.hooks)
   964  
   965  	respBytes, err := proto.Marshal(respContent)
   966  	if err != nil {
   967  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
   968  		return
   969  	}
   970  
   971  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
   972  	resp.Header().Set("Content-Type", "application/protobuf")
   973  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
   974  	resp.WriteHeader(http.StatusOK)
   975  	if n, err := resp.Write(respBytes); err != nil {
   976  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
   977  		twerr := twirp.NewError(twirp.Unknown, msg)
   978  		ctx = callError(ctx, s.hooks, twerr)
   979  	}
   980  	callResponseSent(ctx, s.hooks)
   981  }
   982  
   983  func (s *ingressServer) serveListIngress(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
   984  	header := req.Header.Get("Content-Type")
   985  	i := strings.Index(header, ";")
   986  	if i == -1 {
   987  		i = len(header)
   988  	}
   989  	switch strings.TrimSpace(strings.ToLower(header[:i])) {
   990  	case "application/json":
   991  		s.serveListIngressJSON(ctx, resp, req)
   992  	case "application/protobuf":
   993  		s.serveListIngressProtobuf(ctx, resp, req)
   994  	default:
   995  		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
   996  		twerr := badRouteError(msg, req.Method, req.URL.Path)
   997  		s.writeError(ctx, resp, twerr)
   998  	}
   999  }
  1000  
  1001  func (s *ingressServer) serveListIngressJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
  1002  	var err error
  1003  	ctx = ctxsetters.WithMethodName(ctx, "ListIngress")
  1004  	ctx, err = callRequestRouted(ctx, s.hooks)
  1005  	if err != nil {
  1006  		s.writeError(ctx, resp, err)
  1007  		return
  1008  	}
  1009  
  1010  	d := json.NewDecoder(req.Body)
  1011  	rawReqBody := json.RawMessage{}
  1012  	if err := d.Decode(&rawReqBody); err != nil {
  1013  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
  1014  		return
  1015  	}
  1016  	reqContent := new(ListIngressRequest)
  1017  	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
  1018  	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
  1019  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
  1020  		return
  1021  	}
  1022  
  1023  	handler := s.Ingress.ListIngress
  1024  	if s.interceptor != nil {
  1025  		handler = func(ctx context.Context, req *ListIngressRequest) (*ListIngressResponse, error) {
  1026  			resp, err := s.interceptor(
  1027  				func(ctx context.Context, req interface{}) (interface{}, error) {
  1028  					typedReq, ok := req.(*ListIngressRequest)
  1029  					if !ok {
  1030  						return nil, twirp.InternalError("failed type assertion req.(*ListIngressRequest) when calling interceptor")
  1031  					}
  1032  					return s.Ingress.ListIngress(ctx, typedReq)
  1033  				},
  1034  			)(ctx, req)
  1035  			if resp != nil {
  1036  				typedResp, ok := resp.(*ListIngressResponse)
  1037  				if !ok {
  1038  					return nil, twirp.InternalError("failed type assertion resp.(*ListIngressResponse) when calling interceptor")
  1039  				}
  1040  				return typedResp, err
  1041  			}
  1042  			return nil, err
  1043  		}
  1044  	}
  1045  
  1046  	// Call service method
  1047  	var respContent *ListIngressResponse
  1048  	func() {
  1049  		defer ensurePanicResponses(ctx, resp, s.hooks)
  1050  		respContent, err = handler(ctx, reqContent)
  1051  	}()
  1052  
  1053  	if err != nil {
  1054  		s.writeError(ctx, resp, err)
  1055  		return
  1056  	}
  1057  	if respContent == nil {
  1058  		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListIngressResponse and nil error while calling ListIngress. nil responses are not supported"))
  1059  		return
  1060  	}
  1061  
  1062  	ctx = callResponsePrepared(ctx, s.hooks)
  1063  
  1064  	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
  1065  	respBytes, err := marshaler.Marshal(respContent)
  1066  	if err != nil {
  1067  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
  1068  		return
  1069  	}
  1070  
  1071  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
  1072  	resp.Header().Set("Content-Type", "application/json")
  1073  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
  1074  	resp.WriteHeader(http.StatusOK)
  1075  
  1076  	if n, err := resp.Write(respBytes); err != nil {
  1077  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
  1078  		twerr := twirp.NewError(twirp.Unknown, msg)
  1079  		ctx = callError(ctx, s.hooks, twerr)
  1080  	}
  1081  	callResponseSent(ctx, s.hooks)
  1082  }
  1083  
  1084  func (s *ingressServer) serveListIngressProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
  1085  	var err error
  1086  	ctx = ctxsetters.WithMethodName(ctx, "ListIngress")
  1087  	ctx, err = callRequestRouted(ctx, s.hooks)
  1088  	if err != nil {
  1089  		s.writeError(ctx, resp, err)
  1090  		return
  1091  	}
  1092  
  1093  	buf, err := io.ReadAll(req.Body)
  1094  	if err != nil {
  1095  		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
  1096  		return
  1097  	}
  1098  	reqContent := new(ListIngressRequest)
  1099  	if err = proto.Unmarshal(buf, reqContent); err != nil {
  1100  		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
  1101  		return
  1102  	}
  1103  
  1104  	handler := s.Ingress.ListIngress
  1105  	if s.interceptor != nil {
  1106  		handler = func(ctx context.Context, req *ListIngressRequest) (*ListIngressResponse, error) {
  1107  			resp, err := s.interceptor(
  1108  				func(ctx context.Context, req interface{}) (interface{}, error) {
  1109  					typedReq, ok := req.(*ListIngressRequest)
  1110  					if !ok {
  1111  						return nil, twirp.InternalError("failed type assertion req.(*ListIngressRequest) when calling interceptor")
  1112  					}
  1113  					return s.Ingress.ListIngress(ctx, typedReq)
  1114  				},
  1115  			)(ctx, req)
  1116  			if resp != nil {
  1117  				typedResp, ok := resp.(*ListIngressResponse)
  1118  				if !ok {
  1119  					return nil, twirp.InternalError("failed type assertion resp.(*ListIngressResponse) when calling interceptor")
  1120  				}
  1121  				return typedResp, err
  1122  			}
  1123  			return nil, err
  1124  		}
  1125  	}
  1126  
  1127  	// Call service method
  1128  	var respContent *ListIngressResponse
  1129  	func() {
  1130  		defer ensurePanicResponses(ctx, resp, s.hooks)
  1131  		respContent, err = handler(ctx, reqContent)
  1132  	}()
  1133  
  1134  	if err != nil {
  1135  		s.writeError(ctx, resp, err)
  1136  		return
  1137  	}
  1138  	if respContent == nil {
  1139  		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListIngressResponse and nil error while calling ListIngress. nil responses are not supported"))
  1140  		return
  1141  	}
  1142  
  1143  	ctx = callResponsePrepared(ctx, s.hooks)
  1144  
  1145  	respBytes, err := proto.Marshal(respContent)
  1146  	if err != nil {
  1147  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
  1148  		return
  1149  	}
  1150  
  1151  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
  1152  	resp.Header().Set("Content-Type", "application/protobuf")
  1153  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
  1154  	resp.WriteHeader(http.StatusOK)
  1155  	if n, err := resp.Write(respBytes); err != nil {
  1156  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
  1157  		twerr := twirp.NewError(twirp.Unknown, msg)
  1158  		ctx = callError(ctx, s.hooks, twerr)
  1159  	}
  1160  	callResponseSent(ctx, s.hooks)
  1161  }
  1162  
  1163  func (s *ingressServer) serveDeleteIngress(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
  1164  	header := req.Header.Get("Content-Type")
  1165  	i := strings.Index(header, ";")
  1166  	if i == -1 {
  1167  		i = len(header)
  1168  	}
  1169  	switch strings.TrimSpace(strings.ToLower(header[:i])) {
  1170  	case "application/json":
  1171  		s.serveDeleteIngressJSON(ctx, resp, req)
  1172  	case "application/protobuf":
  1173  		s.serveDeleteIngressProtobuf(ctx, resp, req)
  1174  	default:
  1175  		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
  1176  		twerr := badRouteError(msg, req.Method, req.URL.Path)
  1177  		s.writeError(ctx, resp, twerr)
  1178  	}
  1179  }
  1180  
  1181  func (s *ingressServer) serveDeleteIngressJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
  1182  	var err error
  1183  	ctx = ctxsetters.WithMethodName(ctx, "DeleteIngress")
  1184  	ctx, err = callRequestRouted(ctx, s.hooks)
  1185  	if err != nil {
  1186  		s.writeError(ctx, resp, err)
  1187  		return
  1188  	}
  1189  
  1190  	d := json.NewDecoder(req.Body)
  1191  	rawReqBody := json.RawMessage{}
  1192  	if err := d.Decode(&rawReqBody); err != nil {
  1193  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
  1194  		return
  1195  	}
  1196  	reqContent := new(DeleteIngressRequest)
  1197  	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
  1198  	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
  1199  		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
  1200  		return
  1201  	}
  1202  
  1203  	handler := s.Ingress.DeleteIngress
  1204  	if s.interceptor != nil {
  1205  		handler = func(ctx context.Context, req *DeleteIngressRequest) (*IngressInfo, error) {
  1206  			resp, err := s.interceptor(
  1207  				func(ctx context.Context, req interface{}) (interface{}, error) {
  1208  					typedReq, ok := req.(*DeleteIngressRequest)
  1209  					if !ok {
  1210  						return nil, twirp.InternalError("failed type assertion req.(*DeleteIngressRequest) when calling interceptor")
  1211  					}
  1212  					return s.Ingress.DeleteIngress(ctx, typedReq)
  1213  				},
  1214  			)(ctx, req)
  1215  			if resp != nil {
  1216  				typedResp, ok := resp.(*IngressInfo)
  1217  				if !ok {
  1218  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
  1219  				}
  1220  				return typedResp, err
  1221  			}
  1222  			return nil, err
  1223  		}
  1224  	}
  1225  
  1226  	// Call service method
  1227  	var respContent *IngressInfo
  1228  	func() {
  1229  		defer ensurePanicResponses(ctx, resp, s.hooks)
  1230  		respContent, err = handler(ctx, reqContent)
  1231  	}()
  1232  
  1233  	if err != nil {
  1234  		s.writeError(ctx, resp, err)
  1235  		return
  1236  	}
  1237  	if respContent == nil {
  1238  		s.writeError(ctx, resp, twirp.InternalError("received a nil *IngressInfo and nil error while calling DeleteIngress. nil responses are not supported"))
  1239  		return
  1240  	}
  1241  
  1242  	ctx = callResponsePrepared(ctx, s.hooks)
  1243  
  1244  	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
  1245  	respBytes, err := marshaler.Marshal(respContent)
  1246  	if err != nil {
  1247  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
  1248  		return
  1249  	}
  1250  
  1251  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
  1252  	resp.Header().Set("Content-Type", "application/json")
  1253  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
  1254  	resp.WriteHeader(http.StatusOK)
  1255  
  1256  	if n, err := resp.Write(respBytes); err != nil {
  1257  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
  1258  		twerr := twirp.NewError(twirp.Unknown, msg)
  1259  		ctx = callError(ctx, s.hooks, twerr)
  1260  	}
  1261  	callResponseSent(ctx, s.hooks)
  1262  }
  1263  
  1264  func (s *ingressServer) serveDeleteIngressProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
  1265  	var err error
  1266  	ctx = ctxsetters.WithMethodName(ctx, "DeleteIngress")
  1267  	ctx, err = callRequestRouted(ctx, s.hooks)
  1268  	if err != nil {
  1269  		s.writeError(ctx, resp, err)
  1270  		return
  1271  	}
  1272  
  1273  	buf, err := io.ReadAll(req.Body)
  1274  	if err != nil {
  1275  		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
  1276  		return
  1277  	}
  1278  	reqContent := new(DeleteIngressRequest)
  1279  	if err = proto.Unmarshal(buf, reqContent); err != nil {
  1280  		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
  1281  		return
  1282  	}
  1283  
  1284  	handler := s.Ingress.DeleteIngress
  1285  	if s.interceptor != nil {
  1286  		handler = func(ctx context.Context, req *DeleteIngressRequest) (*IngressInfo, error) {
  1287  			resp, err := s.interceptor(
  1288  				func(ctx context.Context, req interface{}) (interface{}, error) {
  1289  					typedReq, ok := req.(*DeleteIngressRequest)
  1290  					if !ok {
  1291  						return nil, twirp.InternalError("failed type assertion req.(*DeleteIngressRequest) when calling interceptor")
  1292  					}
  1293  					return s.Ingress.DeleteIngress(ctx, typedReq)
  1294  				},
  1295  			)(ctx, req)
  1296  			if resp != nil {
  1297  				typedResp, ok := resp.(*IngressInfo)
  1298  				if !ok {
  1299  					return nil, twirp.InternalError("failed type assertion resp.(*IngressInfo) when calling interceptor")
  1300  				}
  1301  				return typedResp, err
  1302  			}
  1303  			return nil, err
  1304  		}
  1305  	}
  1306  
  1307  	// Call service method
  1308  	var respContent *IngressInfo
  1309  	func() {
  1310  		defer ensurePanicResponses(ctx, resp, s.hooks)
  1311  		respContent, err = handler(ctx, reqContent)
  1312  	}()
  1313  
  1314  	if err != nil {
  1315  		s.writeError(ctx, resp, err)
  1316  		return
  1317  	}
  1318  	if respContent == nil {
  1319  		s.writeError(ctx, resp, twirp.InternalError("received a nil *IngressInfo and nil error while calling DeleteIngress. nil responses are not supported"))
  1320  		return
  1321  	}
  1322  
  1323  	ctx = callResponsePrepared(ctx, s.hooks)
  1324  
  1325  	respBytes, err := proto.Marshal(respContent)
  1326  	if err != nil {
  1327  		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
  1328  		return
  1329  	}
  1330  
  1331  	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
  1332  	resp.Header().Set("Content-Type", "application/protobuf")
  1333  	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
  1334  	resp.WriteHeader(http.StatusOK)
  1335  	if n, err := resp.Write(respBytes); err != nil {
  1336  		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
  1337  		twerr := twirp.NewError(twirp.Unknown, msg)
  1338  		ctx = callError(ctx, s.hooks, twerr)
  1339  	}
  1340  	callResponseSent(ctx, s.hooks)
  1341  }
  1342  
  1343  func (s *ingressServer) ServiceDescriptor() ([]byte, int) {
  1344  	return twirpFileDescriptor1, 0
  1345  }
  1346  
  1347  func (s *ingressServer) ProtocGenTwirpVersion() string {
  1348  	return "v8.1.3"
  1349  }
  1350  
  1351  // PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/"
  1352  // that is everything in a Twirp route except for the <Method>. This can be used for routing,
  1353  // for example to identify the requests that are targeted to this service in a mux.
  1354  func (s *ingressServer) PathPrefix() string {
  1355  	return baseServicePath(s.pathPrefix, "livekit", "Ingress")
  1356  }
  1357  
  1358  var twirpFileDescriptor1 = []byte{
  1359  	// 1207 bytes of a gzipped FileDescriptorProto
  1360  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0xdd, 0x6e, 0x1a, 0x47,
  1361  	0x14, 0xf6, 0x82, 0xf9, 0x3b, 0x04, 0x42, 0x07, 0x12, 0x13, 0x6c, 0xab, 0x16, 0xe9, 0x85, 0xeb,
  1362  	0x54, 0xc4, 0xc6, 0xd8, 0x6d, 0x23, 0x55, 0x2a, 0xd8, 0xb8, 0xac, 0xec, 0xc0, 0x6a, 0xc0, 0xa9,
  1363  	0xda, 0x9b, 0xd5, 0x9a, 0x1d, 0xdb, 0x23, 0xc3, 0xee, 0x76, 0x77, 0x70, 0x43, 0x5f, 0x26, 0x57,
  1364  	0xbd, 0x89, 0x7a, 0xd5, 0x57, 0xe8, 0x23, 0xf4, 0x2d, 0xaa, 0x3e, 0x44, 0x35, 0xb3, 0xc3, 0x7a,
  1365  	0xc1, 0x6b, 0xcb, 0x69, 0xa5, 0xdc, 0xf4, 0x6e, 0xcf, 0xf9, 0xce, 0x39, 0x73, 0xfe, 0xe6, 0x63,
  1366  	0x80, 0x27, 0x23, 0x7a, 0x4d, 0xae, 0x28, 0xd3, 0xa9, 0x75, 0xe1, 0x12, 0xcf, 0xab, 0x39, 0xae,
  1367  	0xcd, 0x6c, 0x94, 0x92, 0xea, 0x4a, 0x69, 0x86, 0x8f, 0x6d, 0x93, 0x8c, 0x24, 0x5c, 0xfd, 0x23,
  1368  	0x06, 0xa5, 0x03, 0x97, 0x18, 0x8c, 0xa8, 0xbe, 0x1b, 0x26, 0x3f, 0x4d, 0x88, 0xc7, 0x50, 0x03,
  1369  	0x80, 0x5a, 0xce, 0x84, 0xe9, 0x6c, 0xea, 0x90, 0xb2, 0xb2, 0xa1, 0x6c, 0xe6, 0xeb, 0x4f, 0x6a,
  1370  	0x32, 0x46, 0x4d, 0x1a, 0xab, 0xdc, 0x02, 0x67, 0x84, 0xe1, 0x60, 0xea, 0x10, 0x84, 0x60, 0xd9,
  1371  	0x32, 0xc6, 0xa4, 0x1c, 0xdb, 0x50, 0x36, 0x33, 0x58, 0x7c, 0xa3, 0x55, 0xc8, 0xb8, 0xb6, 0x3d,
  1372  	0xd6, 0x05, 0x10, 0x17, 0x40, 0x9a, 0x2b, 0xba, 0x1c, 0xdc, 0x81, 0x92, 0x63, 0xb8, 0x8c, 0x0e,
  1373  	0xa9, 0x63, 0x58, 0x4c, 0xa7, 0x26, 0xb1, 0x18, 0x65, 0xd3, 0xf2, 0xb2, 0xb0, 0x2b, 0x86, 0x30,
  1374  	0x55, 0x42, 0xe8, 0x73, 0x28, 0x84, 0x5d, 0x44, 0xd8, 0x84, 0x30, 0x7f, 0x1c, 0xd2, 0x8b, 0xe8,
  1375  	0x75, 0x48, 0x18, 0x13, 0x93, 0xda, 0xe5, 0xe4, 0x86, 0xb2, 0x99, 0xad, 0xaf, 0x2d, 0xe6, 0xdf,
  1376  	0xe4, 0x60, 0xcf, 0x61, 0xd4, 0xb6, 0x3c, 0xec, 0x9b, 0x72, 0x9f, 0x6b, 0x6a, 0x12, 0xbb, 0x9c,
  1377  	0x8a, 0xf6, 0x79, 0xc3, 0xc1, 0xc0, 0x47, 0x98, 0x56, 0xff, 0x56, 0xa0, 0x18, 0x11, 0x32, 0x68,
  1378  	0x87, 0x12, 0x6a, 0xc7, 0x17, 0x90, 0xf4, 0xec, 0x89, 0x3b, 0xf4, 0x9b, 0x94, 0xaf, 0x97, 0x82,
  1379  	0x03, 0x06, 0xae, 0x31, 0xbc, 0xea, 0x0b, 0x0c, 0x4b, 0x1b, 0xf4, 0x0d, 0x24, 0x1d, 0x97, 0x78,
  1380  	0x84, 0x89, 0xce, 0xe5, 0xeb, 0xcf, 0x23, 0x4b, 0x68, 0x5b, 0x43, 0xdb, 0xa4, 0xd6, 0x85, 0x26,
  1381  	0x4c, 0x3b, 0x4b, 0x58, 0x3a, 0xa1, 0x6f, 0x21, 0x65, 0xfb, 0xb9, 0x88, 0x8e, 0x66, 0xeb, 0x9f,
  1382  	0xdd, 0xeb, 0x2f, 0xf3, 0xee, 0x2c, 0xe1, 0x99, 0x5b, 0x0b, 0x41, 0x81, 0x48, 0x54, 0x97, 0xba,
  1383  	0x70, 0xb9, 0xe1, 0x6e, 0x7c, 0x8c, 0x72, 0xc5, 0x79, 0xff, 0xa1, 0xdc, 0x39, 0xff, 0x07, 0x96,
  1384  	0xfb, 0x5e, 0x81, 0xd5, 0x7b, 0xba, 0x85, 0x1a, 0x90, 0x15, 0xab, 0xa3, 0x0f, 0x6d, 0x93, 0x0c,
  1385  	0xe5, 0x5d, 0x29, 0x06, 0x27, 0x0b, 0x9f, 0x03, 0x0e, 0x61, 0x30, 0x82, 0x6f, 0x54, 0x86, 0xd4,
  1386  	0x19, 0x65, 0xae, 0xc1, 0xfc, 0xce, 0xe4, 0xf0, 0x4c, 0x44, 0x9f, 0x42, 0xd6, 0xa4, 0x9e, 0x71,
  1387  	0x36, 0x22, 0xba, 0xc9, 0xde, 0x8a, 0x4e, 0xa4, 0x31, 0x48, 0xd5, 0x21, 0x7b, 0x8b, 0x2a, 0x90,
  1388  	0x1e, 0x5e, 0x1a, 0x96, 0x45, 0x46, 0x7e, 0x9d, 0x39, 0x1c, 0xc8, 0xd5, 0x77, 0x37, 0xc9, 0x46,
  1389  	0xd5, 0xca, 0x93, 0x15, 0x3b, 0x7b, 0x47, 0xb2, 0xc2, 0x47, 0x26, 0x7b, 0x1d, 0x7c, 0xa3, 0x75,
  1390  	0x80, 0x73, 0xd7, 0x18, 0x13, 0x3d, 0xc8, 0x57, 0xc1, 0x19, 0xa1, 0xc1, 0x3c, 0xe3, 0x17, 0x90,
  1391  	0x1c, 0x19, 0x53, 0xe2, 0x7a, 0xe5, 0xf8, 0x46, 0x7c, 0x33, 0xbb, 0x18, 0xef, 0x84, 0x63, 0x58,
  1392  	0x9a, 0x54, 0xff, 0x8c, 0x43, 0x36, 0xe0, 0x8f, 0x73, 0x9b, 0xc7, 0x96, 0x94, 0xa5, 0x53, 0x53,
  1393  	0xee, 0x4e, 0x46, 0x6a, 0x54, 0x33, 0x92, 0x52, 0xd6, 0x01, 0x3c, 0xe6, 0x12, 0x63, 0xac, 0x5f,
  1394  	0x91, 0xa9, 0xe4, 0x94, 0x8c, 0xaf, 0x39, 0x26, 0x53, 0x54, 0x80, 0xf8, 0xc4, 0x1d, 0x49, 0x0e,
  1395  	0xe1, 0x9f, 0x0b, 0x6c, 0x96, 0x78, 0x20, 0x9b, 0x7d, 0x24, 0xfa, 0x98, 0x67, 0xc8, 0xf4, 0x03,
  1396  	0x19, 0x32, 0xf3, 0x61, 0x0c, 0x09, 0xd1, 0x0c, 0x59, 0x81, 0xb4, 0x4b, 0x26, 0x62, 0xb3, 0xca,
  1397  	0x59, 0xb1, 0x68, 0x81, 0x8c, 0x5e, 0x40, 0xc2, 0x63, 0x7c, 0xde, 0x8f, 0x44, 0x29, 0xb7, 0xfa,
  1398  	0xd5, 0xe7, 0x20, 0xf6, 0x6d, 0xaa, 0xef, 0xe2, 0xf0, 0x28, 0xac, 0x47, 0x0d, 0x48, 0x72, 0x64,
  1399  	0xe2, 0xc9, 0x1d, 0x5b, 0x8b, 0x74, 0xaf, 0xf5, 0x85, 0x0d, 0x96, 0xb6, 0xa8, 0x04, 0x09, 0xe2,
  1400  	0xba, 0xb6, 0x2b, 0xc7, 0xed, 0x0b, 0xa8, 0x36, 0x6b, 0x6a, 0x5c, 0x64, 0x52, 0x0e, 0x85, 0x72,
  1401  	0x26, 0x4c, 0xb4, 0x54, 0x26, 0xe3, 0x37, 0xb4, 0x36, 0x1b, 0xdc, 0x72, 0x94, 0xbd, 0x18, 0x9b,
  1402  	0xb4, 0xf7, 0x87, 0xb6, 0x02, 0x29, 0x31, 0x00, 0x6a, 0xca, 0x5f, 0x92, 0x24, 0x17, 0x55, 0xd3,
  1403  	0x5f, 0x34, 0xc3, 0x65, 0xc4, 0xd4, 0x0d, 0x26, 0x46, 0x1a, 0xe7, 0x8b, 0x26, 0x34, 0x4d, 0x86,
  1404  	0x9e, 0x41, 0x9a, 0x58, 0xa6, 0x0f, 0xa6, 0x05, 0x98, 0x12, 0x72, 0x93, 0xa1, 0x2d, 0x48, 0x32,
  1405  	0x4e, 0x70, 0x5e, 0x39, 0x29, 0xae, 0x04, 0x9a, 0xe7, 0x3d, 0xbe, 0xf9, 0x58, 0x5a, 0x54, 0x4d,
  1406  	0x48, 0xfa, 0x6d, 0x40, 0x4f, 0xe0, 0x93, 0x76, 0xf7, 0x50, 0xeb, 0xa9, 0xdd, 0x81, 0xae, 0x76,
  1407  	0x9b, 0x07, 0x03, 0xf5, 0x4d, 0xbb, 0xb0, 0x84, 0x9e, 0x02, 0x0a, 0xd4, 0xad, 0xd3, 0xa3, 0xa3,
  1408  	0x36, 0x56, 0xbb, 0xdf, 0x15, 0x14, 0xb4, 0x02, 0xc5, 0x40, 0xaf, 0x9d, 0xb6, 0x4e, 0xd4, 0x7e,
  1409  	0x87, 0x03, 0x31, 0x84, 0x20, 0x1f, 0x00, 0x6d, 0x8c, 0x7b, 0xb8, 0x10, 0xaf, 0xfe, 0x02, 0x8f,
  1410  	0x17, 0xda, 0xc5, 0x17, 0x6f, 0x4c, 0xc7, 0xe4, 0xe6, 0x37, 0x3e, 0x83, 0xd3, 0x5c, 0x21, 0xb6,
  1411  	0xbf, 0x04, 0x89, 0x9f, 0xa9, 0xc9, 0x2e, 0x45, 0xd3, 0x73, 0xd8, 0x17, 0xd0, 0x53, 0x48, 0x5e,
  1412  	0x12, 0x7a, 0x71, 0xc9, 0x24, 0xf3, 0x48, 0x09, 0xad, 0x81, 0xcf, 0x07, 0x82, 0x20, 0x12, 0x02,
  1413  	0xba, 0x51, 0x54, 0xaf, 0xe4, 0xd9, 0x37, 0xad, 0xbf, 0xff, 0xec, 0x30, 0xc3, 0xc5, 0xe7, 0x19,
  1414  	0x8e, 0xd3, 0xa3, 0x67, 0x8c, 0x9d, 0x91, 0x24, 0x23, 0x3f, 0x0d, 0xf0, 0x55, 0x9c, 0x8d, 0xaa,
  1415  	0xbf, 0xc5, 0xa0, 0x74, 0xea, 0x98, 0xb7, 0xdf, 0x34, 0xff, 0x82, 0x69, 0xfe, 0x07, 0x8f, 0x97,
  1416  	0x1d, 0x40, 0x27, 0xd4, 0x63, 0x0b, 0xbd, 0x9a, 0x2b, 0x5c, 0x99, 0x2f, 0xbc, 0xda, 0x84, 0xe2,
  1417  	0x9c, 0x8b, 0xe7, 0xd8, 0x96, 0x47, 0xd0, 0x16, 0x24, 0x28, 0x23, 0x63, 0x7e, 0xe3, 0xf9, 0xca,
  1418  	0x97, 0x6e, 0x13, 0xec, 0xb9, 0x8d, 0x7d, 0x93, 0xea, 0x1e, 0x94, 0x0e, 0xc9, 0x88, 0x7c, 0xe0,
  1419  	0x8c, 0xb6, 0x6a, 0x01, 0xcb, 0x88, 0x7d, 0x42, 0x79, 0x00, 0x3c, 0x78, 0xad, 0xe9, 0x6a, 0x57,
  1420  	0x3b, 0x1d, 0x14, 0x96, 0xb8, 0xfc, 0x7d, 0x47, 0x9d, 0xc9, 0xca, 0x96, 0x0a, 0x95, 0xbb, 0x1f,
  1421  	0x4a, 0xfc, 0x5e, 0xf5, 0xb4, 0xd3, 0xbe, 0xde, 0x1f, 0xb4, 0x71, 0xbb, 0xa7, 0x7f, 0xbd, 0x7f,
  1422  	0xdc, 0xd2, 0xfa, 0x85, 0x25, 0x54, 0x84, 0xc7, 0x42, 0xff, 0xba, 0xd7, 0xed, 0xe9, 0xfb, 0x8d,
  1423  	0xe3, 0x56, 0xbf, 0xa0, 0x6c, 0xfd, 0xae, 0x04, 0xb1, 0x22, 0x5e, 0x21, 0x68, 0x0d, 0xca, 0x9d,
  1424  	0xfa, 0x7e, 0x43, 0xff, 0xb2, 0xbe, 0xad, 0xe9, 0xbb, 0xdb, 0x47, 0x5a, 0x5f, 0xdf, 0xd5, 0x4f,
  1425  	0x9a, 0x3f, 0xb4, 0x31, 0x8f, 0xb8, 0x0e, 0xcf, 0x04, 0xba, 0xb3, 0xfd, 0xd5, 0x6d, 0x58, 0x09,
  1426  	0x9c, 0xf7, 0x1a, 0xdb, 0x9a, 0x5e, 0xdf, 0xe3, 0x68, 0x7d, 0x86, 0xc6, 0xd0, 0x2a, 0xac, 0x2c,
  1427  	0x86, 0xde, 0xf1, 0xd1, 0x42, 0x3c, 0x70, 0x0d, 0x47, 0x9e, 0xa1, 0xcb, 0xf5, 0x5f, 0x63, 0x90,
  1428  	0x92, 0x49, 0xa3, 0x43, 0xc8, 0xcd, 0x3d, 0xf5, 0xd1, 0x7a, 0x30, 0xa0, 0xa8, 0xbf, 0x00, 0x95,
  1429  	0xc8, 0xf9, 0xf1, 0x28, 0x73, 0x97, 0x2b, 0x14, 0x25, 0xea, 0xd2, 0xdd, 0x11, 0xa5, 0x03, 0xd9,
  1430  	0xd0, 0x06, 0xa1, 0xd5, 0xc0, 0xe8, 0xf6, 0x2a, 0x56, 0xd6, 0xa2, 0x41, 0xb9, 0x74, 0x87, 0x90,
  1431  	0x9b, 0x5b, 0xa4, 0x50, 0x3e, 0x51, 0x0b, 0x16, 0x9d, 0x4f, 0xeb, 0xe8, 0xc7, 0xe7, 0x17, 0x94,
  1432  	0x5d, 0x4e, 0xce, 0x6a, 0x43, 0x7b, 0xfc, 0x52, 0x5a, 0xbc, 0x14, 0xff, 0x91, 0x86, 0xf6, 0x68,
  1433  	0xa6, 0x78, 0x1f, 0xcb, 0x9d, 0xd0, 0x6b, 0x72, 0x4c, 0x59, 0x4d, 0xe3, 0xd0, 0x5f, 0xb1, 0xbc,
  1434  	0x94, 0x5f, 0xbd, 0x12, 0x8a, 0xb3, 0xa4, 0x70, 0xd9, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0xee,
  1435  	0xe1, 0x56, 0x77, 0x8e, 0x0d, 0x00, 0x00,
  1436  }