b4ffaa2cd6
Reduced the amount of boilerplate in Plugin Markdown. Reduced the amount of boilerplate in Plugin Sendmail. Reduced the amount of boilerplate in sample plugins Heythere and Skeleton. Fixed up Plugin GeoIP. It's not ready for use though. Added the routes.FootHeaders function. Added the route_topic_list_start plugin hook.
21 lines
469 B
Go
21 lines
469 B
Go
package main
|
|
|
|
import c "github.com/Azareal/Gosora/common"
|
|
import "github.com/oschwald/geoip2-golang"
|
|
|
|
var geoipDB *geoip.DB
|
|
var geoipDBLocation = "geoip_db.mmdb"
|
|
|
|
func init() {
|
|
c.Plugins.Add(&c.Plugin{UName: "geoip", Name: "Geoip", Author: "Azareal", Init: initGeoip, Deactivate: deactivateGeoip})
|
|
}
|
|
|
|
func initGeoip(plugin *c.Plugin) (err error) {
|
|
geoipDB, err = geoip2.Open(geoipDBLocation)
|
|
return err
|
|
}
|
|
|
|
func deactivateGeoip(plugin *c.Plugin) {
|
|
geoipDB.Close()
|
|
}
|