| 323 | } |
| 324 | |
| 325 | func newClientConfig(rawURL string, options []ClientOption) (*clientConfig, *Error) { |
| 326 | url, err := parseRequestURL(rawURL) |
| 327 | if err != nil { |
| 328 | return nil, err |
| 329 | } |
| 330 | protoPath := extractProtoPath(url.Path) |
| 331 | config := clientConfig{ |
| 332 | URL: url, |
| 333 | Protocol: &protocolConnect{}, |
| 334 | Procedure: protoPath, |
| 335 | CompressionPools: make(map[string]*compressionPool), |
| 336 | BufferPool: newBufferPool(), |
| 337 | } |
| 338 | withProtoBinaryCodec().applyToClient(&config) |
| 339 | withGzip().applyToClient(&config) |
| 340 | for _, opt := range options { |
| 341 | opt.applyToClient(&config) |
| 342 | } |
| 343 | if err := config.validate(); err != nil { |
| 344 | return nil, err |
| 345 | } |
| 346 | return &config, nil |
| 347 | } |
| 348 | |
| 349 | func (c *clientConfig) validate() *Error { |
| 350 | if c.Codec == nil || c.Codec.Name() == "" { |