github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/common/mux/client.go (about)

     1  package mux
     2  
     3  import (
     4  	"github.com/inazumav/sing-box/option"
     5  	"github.com/sagernet/sing-mux"
     6  	N "github.com/sagernet/sing/common/network"
     7  )
     8  
     9  func NewClientWithOptions(dialer N.Dialer, options option.MultiplexOptions) (*Client, error) {
    10  	if !options.Enabled {
    11  		return nil, nil
    12  	}
    13  	return mux.NewClient(mux.Options{
    14  		Dialer:         dialer,
    15  		Protocol:       options.Protocol,
    16  		MaxConnections: options.MaxConnections,
    17  		MinStreams:     options.MinStreams,
    18  		MaxStreams:     options.MaxStreams,
    19  		Padding:        options.Padding,
    20  	})
    21  }