Create & Init Project...
This commit is contained in:
32
app/service/main/location/model/BUILD
Normal file
32
app/service/main/location/model/BUILD
Normal file
@ -0,0 +1,32 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"anonymous.go",
|
||||
"ip.go",
|
||||
"rpc.go",
|
||||
"zlimit.go",
|
||||
],
|
||||
importpath = "go-common/app/service/main/location/model",
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
10
app/service/main/location/model/anonymous.go
Normal file
10
app/service/main/location/model/anonymous.go
Normal file
@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
// AnonymousIP IP database.
|
||||
type AnonymousIP struct {
|
||||
IsAnonymous bool `json:"is_anonymous" maxminddb:"is_anonymous"`
|
||||
IsAnonymousVPN bool `json:"is_anonymous_vpn" maxminddb:"is_anonymous_vpn"`
|
||||
IsHostingProvider bool `json:"is_hosting_provider" maxminddb:"is_hosting_provider"`
|
||||
IsPublicProxy bool `json:"is_public_proxy" maxminddb:"is_public_proxy"`
|
||||
IsTorExitNode bool `json:"is_tor_exit_node" maxminddb:"is_tor_exit_node"`
|
||||
}
|
56
app/service/main/location/model/ip.go
Normal file
56
app/service/main/location/model/ip.go
Normal file
@ -0,0 +1,56 @@
|
||||
package model
|
||||
|
||||
// TmpInfo old api will del soon
|
||||
type TmpInfo struct {
|
||||
Addr string `json:"addr"`
|
||||
ZoneID int64 `json:"zoneId"`
|
||||
Country string `json:"country"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
}
|
||||
|
||||
// Info ipinfo with the smallest zone_id.
|
||||
type Info struct {
|
||||
Addr string `json:"addr"`
|
||||
Country string `json:"country"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
ISP string `json:"isp"`
|
||||
Latitude float64 `json:"latitude"`
|
||||
Longitude float64 `json:"longitude"`
|
||||
ZoneID int64 `json:"zoneId"`
|
||||
CountryCode int `json:"country_code"`
|
||||
}
|
||||
|
||||
// InfoComplete ipinfo with all zone_id.
|
||||
type InfoComplete struct {
|
||||
Addr string `json:"addr"`
|
||||
Country string `json:"country"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
ISP string `json:"isp"`
|
||||
Latitude float64 `json:"latitude"`
|
||||
Longitude float64 `json:"longitude"`
|
||||
ZoneID []int64 `json:"zone_id"`
|
||||
CountryCode int `json:"country_code"`
|
||||
}
|
||||
|
||||
// IP dont' use this, will del soon. use InfoComplete.
|
||||
type IP struct {
|
||||
Addr string `json:"addr"`
|
||||
Country string `json:"country"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
ISP string `json:"isp"`
|
||||
ZoneID []int64 `json:"zone_id"`
|
||||
}
|
||||
|
||||
// Version for check ip library.
|
||||
type Version struct {
|
||||
UpdateTimeV4 string `json:"ipv4_flagship_ipdb_update_time"`
|
||||
NewestV4 string `json:""ipv4_flagship_ipdb_newest_url`
|
||||
StableV4 string `json:"ipv4_flagship_ipdb_stable_url"`
|
||||
UpdateTimeV6 string `json:"ipv6_flagship_ipdb_update_time"`
|
||||
NewestV6 string `json:""ipv6_flagship_ipdb_newest_url`
|
||||
StableV6 string `json:"ipv6_flagship_ipdb_stable_url"`
|
||||
}
|
27
app/service/main/location/model/rpc.go
Normal file
27
app/service/main/location/model/rpc.go
Normal file
@ -0,0 +1,27 @@
|
||||
package model
|
||||
|
||||
// ArgIP for Zone、Info、InfoComplete、Info2
|
||||
type ArgIP struct {
|
||||
IP string
|
||||
}
|
||||
|
||||
// Archive for Archive
|
||||
type Archive struct {
|
||||
Aid int64
|
||||
Mid int64
|
||||
IP string
|
||||
CIP string
|
||||
}
|
||||
|
||||
// Group for group
|
||||
type Group struct {
|
||||
Gid int64
|
||||
Mid int64
|
||||
IP string
|
||||
CIP string
|
||||
}
|
||||
|
||||
// ArgPids for PIDs
|
||||
type ArgPids struct {
|
||||
Pids, IP, CIP string
|
||||
}
|
35
app/service/main/location/model/zlimit.go
Normal file
35
app/service/main/location/model/zlimit.go
Normal file
@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
// auth const
|
||||
const (
|
||||
Forbidden = int64(1)
|
||||
Allow = int64(2)
|
||||
Formal = int64(3)
|
||||
Pay = int64(4)
|
||||
AllowDown = int64(1)
|
||||
ForbiddenDown = int64(0)
|
||||
|
||||
AuthOK = 1
|
||||
AuthNotOK = 0
|
||||
)
|
||||
|
||||
// for prom
|
||||
var (
|
||||
PlayAuth = map[int64]string{
|
||||
Forbidden: "play_forbidden",
|
||||
Allow: "play_allown",
|
||||
Formal: "play_formal_member",
|
||||
Pay: "play_pay_member",
|
||||
}
|
||||
|
||||
DownAuth = map[int64]string{
|
||||
ForbiddenDown: "down_forbidden",
|
||||
AllowDown: "down_allown",
|
||||
}
|
||||
)
|
||||
|
||||
// Auth for auth result
|
||||
type Auth struct {
|
||||
Play int64 `json:"play"`
|
||||
Down int64 `json:"down"`
|
||||
}
|
Reference in New Issue
Block a user