github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/proxy/http/simplified/config.go (about)

     1  package simplified
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/v2fly/v2ray-core/v5/common"
     7  	"github.com/v2fly/v2ray-core/v5/common/protocol"
     8  	"github.com/v2fly/v2ray-core/v5/proxy/http"
     9  )
    10  
    11  func init() {
    12  	common.Must(common.RegisterConfig((*ServerConfig)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
    13  		simplifiedServer := config.(*ServerConfig)
    14  		_ = simplifiedServer
    15  		fullServer := &http.ServerConfig{}
    16  		return common.CreateObject(ctx, fullServer)
    17  	}))
    18  
    19  	common.Must(common.RegisterConfig((*ClientConfig)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
    20  		simplifiedClient := config.(*ClientConfig)
    21  		fullClient := &http.ClientConfig{
    22  			Server: []*protocol.ServerEndpoint{
    23  				{
    24  					Address: simplifiedClient.Address,
    25  					Port:    simplifiedClient.Port,
    26  				},
    27  			},
    28  			H1SkipWaitForReply: simplifiedClient.H1SkipWaitForReply,
    29  		}
    30  		return common.CreateObject(ctx, fullClient)
    31  	}))
    32  }