New creates new Parser instance
(ctx context.Context, config *Config)
| 10 | |
| 11 | // New creates new Parser instance |
| 12 | func New(ctx context.Context, config *Config) (*Parser, error) { |
| 13 | if err := config.Validate(); err != nil { |
| 14 | return nil, err |
| 15 | } |
| 16 | |
| 17 | p := &Parser{ |
| 18 | config: config, |
| 19 | presets: make(map[string][]urlOption), |
| 20 | } |
| 21 | |
| 22 | if err := p.parsePresets(); err != nil { |
| 23 | return nil, err |
| 24 | } |
| 25 | |
| 26 | if err := p.validatePresets(ctx); err != nil { |
| 27 | return nil, err |
| 28 | } |
| 29 | |
| 30 | return p, nil |
| 31 | } |
| 32 | |
| 33 | func (p *Parser) IsSecurityOptionsAllowed(ctx context.Context) error { |
| 34 | if p.config.AllowSecurityOptions { |
nothing calls this directly
no test coverage detected