(host string)
| 25 | } |
| 26 | |
| 27 | func (w *Wildcard) Parse(host string) (bucket string, is bool) { |
| 28 | if is = w.r.MatchString(host); is { |
| 29 | var index int |
| 30 | if index = strings.Index(host, "."+w.domain); index == -1 { |
| 31 | is = false |
| 32 | return |
| 33 | } |
| 34 | bucket = host[:index] |
| 35 | return |
| 36 | } |
| 37 | return |
| 38 | } |
| 39 | |
| 40 | func NewWildcard(domain string) (*Wildcard, error) { |
| 41 | regexpString := "^(([a-zA-Z0-9]|-|_)+.)+" + domain + "(:(\\d)+)*$" |