sing-box/common/mux/client.go

22 lines
536 B
Go
Raw Normal View History

2022-07-29 16:29:22 +00:00
package mux
import (
"github.com/sagernet/sing-box/option"
2023-04-20 03:16:22 +00:00
"github.com/sagernet/sing-mux"
2022-07-29 16:29:22 +00:00
N "github.com/sagernet/sing/common/network"
)
2023-04-20 03:16:22 +00:00
func NewClientWithOptions(dialer N.Dialer, options option.MultiplexOptions) (*Client, error) {
2022-07-29 16:29:22 +00:00
if !options.Enabled {
2022-08-04 01:11:39 +00:00
return nil, nil
2022-07-29 16:29:22 +00:00
}
2023-04-20 03:16:22 +00:00
return mux.NewClient(mux.Options{
Dialer: dialer,
Protocol: options.Protocol,
MaxConnections: options.MaxConnections,
MinStreams: options.MinStreams,
MaxStreams: options.MaxStreams,
Padding: options.Padding,
})
2022-07-29 16:29:22 +00:00
}