Documentation ¶
Index ¶
- Constants
- Variables
- type DB
- func (db *DB) Fetch(dbURL string) (err error)
- func (db *DB) FetchFull() error
- func (db *DB) GetETLD(hostname []byte) []byte
- func (db *DB) GetETLD1(hostname []byte) []byte
- func (db *DB) GetETLD1Str(hostname string) string
- func (db *DB) GetETLDStr(hostname string) string
- func (db *DB) GetEffectiveTLD(hostname []byte) (etld []byte)
- func (db *DB) GetEffectiveTLDPlusOne(hostname []byte) (etld1 []byte)
- func (db *DB) GetEffectiveTLDPlusOneStr(hostname string) (etld1 string)
- func (db *DB) GetEffectiveTLDStr(hostname string) (etld string)
- func (db *DB) GetTLD(hostname []byte) (tld []byte, icann bool)
- func (db *DB) GetTLDStr(hostname string) (tld string, icann bool)
- func (db *DB) Load(dbFile string) (err error)
- func (db *DB) LoadOrFetchFullIf(dbFile string, expire time.Duration) error
- func (db *DB) LoadOrFetchIf(dbFile, dbURL string, expire time.Duration) error
- func (db *DB) Parse(hostname []byte) (tld, etld, etld1 []byte, icann bool)
- func (db *DB) ParseStr(hostname string) (tld, etld, etld1 string, icann bool)
- func (db *DB) Reset()
Constants ¶
const (
// FullURL of full known PSL data.
FullURL = "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat"
)
Variables ¶
var ( ErrBadDB = errors.New("cache uninitialized, use New()") ErrNoHasher = errors.New("no hasher provided") )
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is an implementation of Mozilla Public Suffix List database.
func (*DB) GetETLD1Str ¶
GetETLD1Str is a shorthand alias of GetEffectiveTLDPlusOneStr.
func (*DB) GetETLDStr ¶
GetETLDStr is a shorthand alias of GetEffectiveTLDStr.
func (*DB) GetEffectiveTLD ¶
GetEffectiveTLD returns only eTLD part of hostname.
func (*DB) GetEffectiveTLDPlusOne ¶
GetEffectiveTLDPlusOne return only eTLD1 part of hostname.
func (*DB) GetEffectiveTLDPlusOneStr ¶
GetEffectiveTLDPlusOneStr return only eTLD1 part of string hostname.
func (*DB) GetEffectiveTLDStr ¶
GetEffectiveTLDStr returns only eTLD part of string hostname.
func (*DB) LoadOrFetchFullIf ¶
LoadOrFetchFullIf is similar to LoadOrFetchIf but loads data from full URL.
func (*DB) LoadOrFetchIf ¶
LoadOrFetchIf loads PSL data from local file (if file is younger than expire param) or load data from given URL.
After fetching from URL raw PSL data will be stored to local file (if possible).