Documentation ¶
Index ¶
- Variables
- func Dedication() string
- func DefaultServer(port string, method string) error
- func GetDefaultServerPage(method string) string
- func GetLinkStatsHeader(ls LinkStats) string
- func GetLinkStatsURL(ls LinkStats) *url.URL
- func GetPrettyRequest(ls LinkStats) string
- func GetPrettyResponse(ls LinkStats) string
- func MakeLinkStatsJSON(ls LinkStats) string
- func Version() string
- func VersionNumber() string
- func VersionText() string
- type LinkStats
Constants ¶
This section is empty.
Variables ¶
var GenerateSnapshotErr = "error generating snapshot"
GenerateSnapshotErr tells us we've something else wrong
var ResponseIncorrect = "snapshots not created for response codes zero or greater than 400"
ResponseIncorrect tells us we haven't created a screenshot because the domain is no longer in existence...
var SnapshotNotEnabled = "snapshots are not currently enabled"
SnapshotNotEnabled helps end users verify server status
Functions ¶
func Dedication ¶
func Dedication() string
Dedication will return a dedication string for a colleague's dear brother who was lost on the day I first figured out this code.
func DefaultServer ¶
DefaultServer is our call to standup a default server for the httpreserve resolver service to be queried by our other apps.
func GetDefaultServerPage ¶
GetDefaultServerPage will print an example server page with the template filled in using the given method. Useful for folk who want to learn about this app. A bit of Ajax and a pretty decent way of encoding Base64 data hyperlinks.
func GetLinkStatsHeader ¶
GetLinkStatsHeader allows us to do some debug on the information returned from the server. First it mocks a response, and then adds some of our own information to it to enable DumpResponse prettyprint. We will consider its use in future As two pretty printed responses have been added to the struct.
func GetLinkStatsURL ¶
GetLinkStatsURL returns the originally parsed URL as was sent to the server for a response.
func GetPrettyRequest ¶
GetPrettyRequest returns the original request but pretty printed..
func GetPrettyResponse ¶
GetPrettyResponse returns the original response but pretty printed.
func MakeLinkStatsJSON ¶
MakeLinkStatsJSON will output a LinkStats struct as a JSON object to be used in our applications...
func VersionText ¶
func VersionText() string
VersionText will return the full text version information e.g. for the useragent to query our websites.
Types ¶
type LinkStats ¶
type LinkStats struct { FileName string `json:"FileName,omitempty"` // If a filename is provided AnalysisVersionNumber string AnalysisVersionText string SimpleRequestVersion string Link string Title string ContentType string ResponseCode int ResponseText string SourceURL string // URL requested by the caller ScreenShot string // HREF to screenshot InternetArchiveLinkEarliest string `json:"InternetArchiveLinkEarliest,omitempty"` InternetArchiveEarliestDate string `json:"InternetArchiveEarliestDate,omitempty"` InternetArchiveLinkLatest string InternetArchiveLatestDate string `json:"InternetArchiveLatestDate,omitempty"` InternetArchiveSaveLink string // Link to use to save from the Internet InternetArchiveResponseCode int InternetArchiveResponseText string RobustLinkEarliest string `json:"RobustLinkEarliest,omitempty"` // A robust hyperlink snippet linking to a live url and a memento version RobustLinkLatest string `json:"RobustLinkLatest,omitempty"` // A robust hyperlink snippet linking to a live url and a memento version PWID string `json:PWID,omitempty` // Persistent Web Identifier DRAFT URN standard from Denmark. Archived bool // Has the Internet Archive saved the page or not? Error bool ErrorMessage string StatsCreationTime string // contains filtered or unexported fields }
LinkStats Table structure to be returned from our requests Can be fairly liberal in its expansion
func GenerateLinkStats ¶
GenerateLinkStats is used to return a JSON object for a URL specified in link variable passed to the function.
func GenerateLinkStatsEncoded ¶
GenerateLinkStatsEncoded encodes LinkStat JSON with HTML entities for display online, e.g. on HTTPreserve.info.
func HTTPFromSimpleRequest ¶
func HTTPFromSimpleRequest(sr simplerequest.SimpleRequest, sourceURL string) (LinkStats, error)
HTTPFromSimpleRequest is another mechanism we can use to retrieve some basic information out from a web resource. Call handlehttp from a SimpleRequest object instead of calling function directly...