Simple domain parser
go get github.com/waitingkuo/domainutil
package main
import (
"fmt"
"github.com/waitingkuo/domainutil"
)
func main() {
domain, err := domainutil.ParseFromRawURL("http://www.google.com")
if err != nil {
panic(err)
}
fmt.Println("RootDomain:", domain.RootDomain)
fmt.Println("SubDomain:", domain.SubDomain)
}
RootDomain: google.com
SubDomain: www
Feel free to leave any commands or issues