github.com/cloudwego/kitex@v0.9.0/internal/server/remote_option.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  /*
     5   * Copyright 2022 CloudWeGo Authors
     6   *
     7   * Licensed under the Apache License, Version 2.0 (the "License");
     8   * you may not use this file except in compliance with the License.
     9   * You may obtain a copy of the License at
    10   *
    11   *     http://www.apache.org/licenses/LICENSE-2.0
    12   *
    13   * Unless required by applicable law or agreed to in writing, software
    14   * distributed under the License is distributed on an "AS IS" BASIS,
    15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16   * See the License for the specific language governing permissions and
    17   * limitations under the License.
    18   */
    19  
    20  // Package server defines the Options about remote transport of client.
    21  package server
    22  
    23  import (
    24  	"github.com/cloudwego/kitex/pkg/remote"
    25  	"github.com/cloudwego/kitex/pkg/remote/codec"
    26  	"github.com/cloudwego/kitex/pkg/remote/trans/detection"
    27  	"github.com/cloudwego/kitex/pkg/remote/trans/netpoll"
    28  	"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2"
    29  	"github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/grpc"
    30  )
    31  
    32  func newServerRemoteOption() *remote.ServerOption {
    33  	return &remote.ServerOption{
    34  		TransServerFactory:    netpoll.NewTransServerFactory(),
    35  		SvrHandlerFactory:     detection.NewSvrTransHandlerFactory(netpoll.NewSvrTransHandlerFactory(), nphttp2.NewSvrTransHandlerFactory()),
    36  		Codec:                 codec.NewDefaultCodec(),
    37  		Address:               defaultAddress,
    38  		ExitWaitTime:          defaultExitWaitTime,
    39  		MaxConnectionIdleTime: defaultConnectionIdleTime,
    40  		AcceptFailedDelayTime: defaultAcceptFailedDelayTime,
    41  		GRPCCfg:               grpc.DefaultServerConfig(),
    42  	}
    43  }