security.go 772 B

12345678910111213141516171819202122232425262728
  1. package security
  2. // Security represents the security package instance
  3. type Security struct {
  4. config *Config
  5. }
  6. // New creates a new Security instance
  7. func New(config *Config) (*Security, error) {
  8. if err := config.Validate(); err != nil {
  9. return nil, err
  10. }
  11. return &Security{
  12. config: config,
  13. }, nil
  14. }
  15. // NewOptions creates a new security.Options instance
  16. func (s *Security) NewOptions() Options {
  17. return Options{
  18. MaxSrcResolution: s.config.Options.MaxSrcResolution,
  19. MaxSrcFileSize: s.config.Options.MaxSrcFileSize,
  20. MaxAnimationFrames: s.config.Options.MaxAnimationFrames,
  21. MaxAnimationFrameResolution: s.config.Options.MaxAnimationFrameResolution,
  22. MaxResultDimension: s.config.Options.MaxResultDimension,
  23. }
  24. }