package awg

import "strings"

// Detect is also used by linknorm / netcheck.
func LooksLike(raw string) bool { return Detect(raw) }

// IsAWG20 returns true when obfuscation params typical of AWG 1.5/2.0 are present.
func (c Conf) IsAWG20() bool {
	if c.I1 != "" || c.I2 != "" || c.I3 != "" || c.I4 != "" || c.I5 != "" {
		return true
	}
	if c.Jc != 0 || c.Jmin != 0 || c.Jmax != 0 {
		return true
	}
	if c.S1 != 0 || c.S2 != 0 || c.S3 != 0 || c.S4 != 0 {
		return true
	}
	if c.H1 != "" || c.H2 != "" || c.H3 != "" || c.H4 != "" {
		return true
	}
	return false
}

// StripBOM removes a UTF-8 BOM if present.
func StripBOM(s string) string {
	return strings.TrimPrefix(s, "\ufeff")
}
