gosora/experimental/plugin_geoip.go
Azareal b4ffaa2cd6 Initial work on Plugin Hyperdrive.
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.
2019-04-20 14:55:22 +10:00

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()
}