Aucune description

internet.go 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. Package internet produces queryable information about the internet by
  3. fetching and downloading ripe BGP dumps and cidr-report.org data into redis
  4. databases.
  5. THE APIs WILL BE CONSIDERED STABLE WHEN THIS MESSAGE IS REMOVED IN MAY 2015.
  6. Features
  7. Download BGP table dumps from http://data.ris.ripe.net/rrc00. Entries are
  8. stored into redis for current and historical IP address to AS Number lookup.
  9. Download http://www.cidr-report.org/as2.0/autnums.html (controlled to once per
  10. day). Entries are stored in redis for current and historical AS Number to AS
  11. Description lookup.
  12. All downloads are cached so that databases can be rebuilt on demand.
  13. A Redis server is used to store and make lookups against.
  14. Acknowledgments
  15. Basic design for the IP2ASN history and ASN2ASDescription parts were inspired
  16. from https://github.com/CIRCL/IP-ASN-history and
  17. https://github.com/CIRCL/ASN-Description-History.
  18. */
  19. package internet
  20. import (
  21. "fmt"
  22. "os"
  23. "path/filepath"
  24. )
  25. type ParseError struct {
  26. Message string
  27. Path string
  28. LineNum int
  29. Line string
  30. }
  31. func (p ParseError) Error() string {
  32. return fmt.Sprintf("parse error: %s in %s:%d: %s", p.Message, p.Path, p.LineNum, p.Line)
  33. }
  34. var dataDir = filepath.Join(os.TempDir(), "internet")
  35. // SetDataDir sets the storage directory for downloads cache and temporary files.
  36. func SetDataDir(path string) {
  37. dataDir = path
  38. }