github.com/qjfoidnh/BaiduPCS-Go@v0.0.0-20231011165705-caa18a3765f3/baidupcs/publicsuffix.go (about)

     1  package baidupcs
     2  
     3  import (
     4  	"net/http/cookiejar"
     5  	"strings"
     6  )
     7  
     8  type list struct{}
     9  
    10  // PublicSuffixList baidupcs PublicSuffixList
    11  var PublicSuffixList cookiejar.PublicSuffixList = list{}
    12  
    13  func (list) PublicSuffix(domain string) string {
    14  	if strings.HasSuffix(domain, ".baidu.com") {
    15  		return "com"
    16  	}
    17  	return domain
    18  }
    19  
    20  func (list) String() string {
    21  	return "baidupcs"
    22  }