mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 13:10:24 +08:00 
			
		
		
		
	实现集成的IP库/初步完成IP库制作API
This commit is contained in:
		
							
								
								
									
										9524
									
								
								build/rpc.json
									
									
									
									
									
								
							
							
						
						
									
										9524
									
								
								build/rpc.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -30,6 +30,7 @@ type MethodInfo struct {
 | 
			
		||||
	Code                string   `json:"code"`
 | 
			
		||||
	Doc                 string   `json:"doc"`
 | 
			
		||||
	Roles               []string `json:"roles"`
 | 
			
		||||
	IsDeprecated        bool     `json:"isDeprecated"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type MessageInfo struct {
 | 
			
		||||
@@ -197,7 +198,7 @@ func main() {
 | 
			
		||||
						// 先将rpc代码替换成临时代码
 | 
			
		||||
						var methodCodeMap = map[string][]byte{} // code => method
 | 
			
		||||
						var methodIndex = 0
 | 
			
		||||
						var methodReg = regexp.MustCompile(`rpc\s+(\w+)\s*\(\s*(\w+)\s*\)\s*returns\s*\(\s*(\w+)\s*\)\s*;`)
 | 
			
		||||
						var methodReg = regexp.MustCompile(`(?s)rpc\s+(\w+)\s*\(\s*(\w+)\s*\)\s*returns\s*\(\s*(\w+)\s*\)\s*(\{.+})?\s*;`)
 | 
			
		||||
						data = methodReg.ReplaceAllFunc(data, func(methodData []byte) []byte {
 | 
			
		||||
							methodIndex++
 | 
			
		||||
							var code = "METHOD" + types.String(methodIndex)
 | 
			
		||||
@@ -236,6 +237,7 @@ func main() {
 | 
			
		||||
									Name:                string(methodPieces[1]),
 | 
			
		||||
									RequestMessageName:  string(methodPieces[2]),
 | 
			
		||||
									ResponseMessageName: string(methodPieces[3]),
 | 
			
		||||
									IsDeprecated:        strings.Contains(string(methodPieces[4]), "deprecated"),
 | 
			
		||||
									Code:                string(methodData),
 | 
			
		||||
									Doc:                 readComments(serviceData[:methodCodePosition[0]]),
 | 
			
		||||
									Roles:               roles,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										77
									
								
								pkg/iplibrary/default_ip_library.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								pkg/iplibrary/default_ip_library.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
			
		||||
 | 
			
		||||
package iplibrary
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"compress/gzip"
 | 
			
		||||
	_ "embed"
 | 
			
		||||
	"github.com/iwind/TeaGo/logs"
 | 
			
		||||
	"net"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
//go:embed internal-ip-library.db
 | 
			
		||||
var ipLibraryData []byte
 | 
			
		||||
 | 
			
		||||
var library = NewIPLibrary()
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	err := library.Init()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		logs.Println("IP_LIBRARY", "initialized failed: "+err.Error())
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Lookup(ip net.IP) *QueryResult {
 | 
			
		||||
	return library.Lookup(ip)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func LookupIP(ip string) *QueryResult {
 | 
			
		||||
	return library.LookupIP(ip)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type IPLibrary struct {
 | 
			
		||||
	reader *Reader
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewIPLibrary() *IPLibrary {
 | 
			
		||||
	return &IPLibrary{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IPLibrary) Init() error {
 | 
			
		||||
	var reader = bytes.NewReader(ipLibraryData)
 | 
			
		||||
	gzipReader, err := gzip.NewReader(reader)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer func() {
 | 
			
		||||
		_ = gzipReader.Close()
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	libReader, err := NewReader(gzipReader)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	this.reader = libReader
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IPLibrary) Lookup(ip net.IP) *QueryResult {
 | 
			
		||||
	if this.reader == nil {
 | 
			
		||||
		return &QueryResult{}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var result = this.reader.Lookup(ip)
 | 
			
		||||
	if result == nil {
 | 
			
		||||
		result = &QueryResult{}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IPLibrary) LookupIP(ip string) *QueryResult {
 | 
			
		||||
	if this.reader == nil {
 | 
			
		||||
		return &QueryResult{}
 | 
			
		||||
	}
 | 
			
		||||
	return this.Lookup(net.ParseIP(ip))
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										62
									
								
								pkg/iplibrary/default_ip_library_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								pkg/iplibrary/default_ip_library_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
			
		||||
 | 
			
		||||
package iplibrary_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
 | 
			
		||||
	"net"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestIPLibrary_Lookup(t *testing.T) {
 | 
			
		||||
	var lib = iplibrary.NewIPLibrary()
 | 
			
		||||
	err := lib.Init()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	for _, ip := range []string{
 | 
			
		||||
		"127.0.0.1",
 | 
			
		||||
		"8.8.8.8",
 | 
			
		||||
		"4.4.4.4",
 | 
			
		||||
		"202.96.0.20",
 | 
			
		||||
		"66.249.66.69",
 | 
			
		||||
		"2222",                           // wrong ip
 | 
			
		||||
		"2406:8c00:0:3401:133:18:168:70", // ipv6
 | 
			
		||||
	} {
 | 
			
		||||
		var result = lib.Lookup(net.ParseIP(ip))
 | 
			
		||||
		t.Log(ip, "=>", result.IsOk(), "[", result.CountryName(), result.CountryId(), "][", result.ProvinceName(), result.ProvinceId(), "][", result.TownName(), result.TownId(), "][", result.ProviderName(), result.ProviderId(), "]")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestIPLibrary_LookupIP(t *testing.T) {
 | 
			
		||||
	var lib = iplibrary.NewIPLibrary()
 | 
			
		||||
	err := lib.Init()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, ip := range []string{
 | 
			
		||||
		"66.249.66.69",
 | 
			
		||||
	} {
 | 
			
		||||
		var result = lib.LookupIP(ip)
 | 
			
		||||
		if result.IsOk() {
 | 
			
		||||
			t.Log(ip, "=>", result.IsOk(), "[", result.CountryName(), result.CountryId(), "][", result.ProvinceName(), result.ProvinceId(), "][", result.TownName(), result.TownId(), "][", result.ProviderName(), result.ProviderId(), "]")
 | 
			
		||||
		} else {
 | 
			
		||||
			t.Log(ip, "=>", result.IsOk())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func BenchmarkIPLibrary_Lookup(b *testing.B) {
 | 
			
		||||
	var lib = iplibrary.NewIPLibrary()
 | 
			
		||||
	err := lib.Init()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		b.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	b.ResetTimer()
 | 
			
		||||
 | 
			
		||||
	for i := 0; i < b.N; i++ {
 | 
			
		||||
		_ = lib.LookupIP("66.249.66.69")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								pkg/iplibrary/internal-ip-library.db
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								pkg/iplibrary/internal-ip-library.db
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -102,6 +102,10 @@ func (this *Reader) load(reader io.Reader) error {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Reader) Lookup(ip net.IP) *QueryResult {
 | 
			
		||||
	if ip == nil {
 | 
			
		||||
		return &QueryResult{}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var ipLong = configutils.IP2Long(ip)
 | 
			
		||||
	var isV4 = configutils.IsIPv4(ip)
 | 
			
		||||
	var resultItem *ipItem
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNewFileReader(t *testing.T) {
 | 
			
		||||
	reader, err := iplibrary.NewFileReader("./ip.db")
 | 
			
		||||
	reader, err := iplibrary.NewFileReader("./ip")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
@@ -37,6 +37,7 @@ func TestNewFileReader(t *testing.T) {
 | 
			
		||||
				"townName":     result.TownName(),
 | 
			
		||||
				"providerId":   result.ProviderId(),
 | 
			
		||||
				"providerName": result.ProviderName(),
 | 
			
		||||
				"summary":      result.Summary(),
 | 
			
		||||
			}
 | 
			
		||||
			dataJSON, err := json.MarshalIndent(data, "", "  ")
 | 
			
		||||
			if err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,11 @@
 | 
			
		||||
 | 
			
		||||
package iplibrary
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/iwind/TeaGo/lists"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type QueryResult struct {
 | 
			
		||||
	item *ipItem
 | 
			
		||||
	meta *Meta
 | 
			
		||||
@@ -19,6 +24,9 @@ func (this *QueryResult) CountryId() int64 {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) CountryName() string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.countryId > 0 {
 | 
			
		||||
		var country = this.meta.CountryWithId(this.item.countryId)
 | 
			
		||||
		if country != nil {
 | 
			
		||||
@@ -28,6 +36,19 @@ func (this *QueryResult) CountryName() string {
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) CountryCodes() []string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.countryId > 0 {
 | 
			
		||||
		var country = this.meta.CountryWithId(this.item.countryId)
 | 
			
		||||
		if country != nil {
 | 
			
		||||
			return country.Codes
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) ProvinceId() int64 {
 | 
			
		||||
	if this.item != nil {
 | 
			
		||||
		return this.item.provinceId
 | 
			
		||||
@@ -36,6 +57,9 @@ func (this *QueryResult) ProvinceId() int64 {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) ProvinceName() string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.provinceId > 0 {
 | 
			
		||||
		var province = this.meta.ProvinceWithId(this.item.provinceId)
 | 
			
		||||
		if province != nil {
 | 
			
		||||
@@ -45,6 +69,19 @@ func (this *QueryResult) ProvinceName() string {
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) ProvinceCodes() []string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.provinceId > 0 {
 | 
			
		||||
		var province = this.meta.ProvinceWithId(this.item.provinceId)
 | 
			
		||||
		if province != nil {
 | 
			
		||||
			return province.Codes
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) CityId() int64 {
 | 
			
		||||
	if this.item != nil {
 | 
			
		||||
		return this.item.cityId
 | 
			
		||||
@@ -53,6 +90,9 @@ func (this *QueryResult) CityId() int64 {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) CityName() string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.cityId > 0 {
 | 
			
		||||
		var city = this.meta.CityWithId(this.item.cityId)
 | 
			
		||||
		if city != nil {
 | 
			
		||||
@@ -70,6 +110,9 @@ func (this *QueryResult) TownId() int64 {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) TownName() string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.townId > 0 {
 | 
			
		||||
		var town = this.meta.TownWithId(this.item.townId)
 | 
			
		||||
		if town != nil {
 | 
			
		||||
@@ -87,6 +130,9 @@ func (this *QueryResult) ProviderId() int64 {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) ProviderName() string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.providerId > 0 {
 | 
			
		||||
		var provider = this.meta.ProviderWithId(this.item.providerId)
 | 
			
		||||
		if provider != nil {
 | 
			
		||||
@@ -95,3 +141,51 @@ func (this *QueryResult) ProviderName() string {
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) ProviderCodes() []string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	if this.item.providerId > 0 {
 | 
			
		||||
		var provider = this.meta.ProviderWithId(this.item.providerId)
 | 
			
		||||
		if provider != nil {
 | 
			
		||||
			return provider.Codes
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *QueryResult) Summary() string {
 | 
			
		||||
	if this.item == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var pieces = []string{}
 | 
			
		||||
	var countryName = this.CountryName()
 | 
			
		||||
	var provinceName = this.ProvinceName()
 | 
			
		||||
	var cityName = this.CityName()
 | 
			
		||||
	var townName = this.TownName()
 | 
			
		||||
	var providerName = this.ProviderName()
 | 
			
		||||
 | 
			
		||||
	if len(countryName) > 0 {
 | 
			
		||||
		pieces = append(pieces, countryName)
 | 
			
		||||
	}
 | 
			
		||||
	if len(provinceName) > 0 && !lists.ContainsString(pieces, provinceName) {
 | 
			
		||||
		pieces = append(pieces, provinceName)
 | 
			
		||||
	}
 | 
			
		||||
	if len(cityName) > 0 && !lists.ContainsString(pieces, cityName) && !lists.ContainsString(pieces, strings.TrimSuffix(cityName, "市")) {
 | 
			
		||||
		pieces = append(pieces, cityName)
 | 
			
		||||
	}
 | 
			
		||||
	if len(townName) > 0 && !lists.ContainsString(pieces, townName) && !lists.ContainsString(pieces, strings.TrimSuffix(townName, "县")) {
 | 
			
		||||
		pieces = append(pieces, cityName)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(providerName) > 0 && !lists.ContainsString(pieces, providerName) {
 | 
			
		||||
		if len(pieces) > 0 {
 | 
			
		||||
			pieces = append(pieces, "|")
 | 
			
		||||
		}
 | 
			
		||||
		pieces = append(pieces, providerName)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return strings.Join(pieces, " ")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ func (this *Template) Extract(text string, emptyValues []string) (values map[str
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		var v = matches[index]
 | 
			
		||||
		if name != "ipFrom" && name != "ipTo" && (v == "0" || v == "无" || lists.ContainsString(emptyValues, v)) {
 | 
			
		||||
		if name != "ipFrom" && name != "ipTo" && (v == "0" || v == "无" || v == "空" || lists.ContainsString(emptyValues, v)) {
 | 
			
		||||
			v = ""
 | 
			
		||||
		}
 | 
			
		||||
		values[name] = v
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNewFileWriter(t *testing.T) {
 | 
			
		||||
	writer, err := iplibrary.NewFileWriter("./ip.db", &iplibrary.Meta{
 | 
			
		||||
	writer, err := iplibrary.NewFileWriter("./internal-ip-library.db", &iplibrary.Meta{
 | 
			
		||||
		Author: "GoEdge",
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -30,15 +30,20 @@ type IPLibraryFile struct {
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	Id            int64                     `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
 | 
			
		||||
	FileId        int64                     `protobuf:"varint,2,opt,name=fileId,proto3" json:"fileId,omitempty"`
 | 
			
		||||
	IsFinished    bool                      `protobuf:"varint,3,opt,name=isFinished,proto3" json:"isFinished,omitempty"`
 | 
			
		||||
	CreatedAt     int64                     `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
 | 
			
		||||
	CountryNames  []string                  `protobuf:"bytes,5,rep,name=countryNames,proto3" json:"countryNames,omitempty"`
 | 
			
		||||
	Provinces     []*IPLibraryFile_Province `protobuf:"bytes,6,rep,name=provinces,proto3" json:"provinces,omitempty"`
 | 
			
		||||
	Cities        []*IPLibraryFile_City     `protobuf:"bytes,7,rep,name=cities,proto3" json:"cities,omitempty"`
 | 
			
		||||
	Towns         []*IPLibraryFile_Town     `protobuf:"bytes,8,rep,name=towns,proto3" json:"towns,omitempty"`
 | 
			
		||||
	ProviderNames []string                  `protobuf:"bytes,9,rep,name=providerNames,proto3" json:"providerNames,omitempty"`
 | 
			
		||||
	Id              int64                     `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
 | 
			
		||||
	Name            string                    `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
 | 
			
		||||
	FileId          int64                     `protobuf:"varint,3,opt,name=fileId,proto3" json:"fileId,omitempty"`
 | 
			
		||||
	Template        string                    `protobuf:"bytes,4,opt,name=template,proto3" json:"template,omitempty"`
 | 
			
		||||
	EmptyValues     []string                  `protobuf:"bytes,5,rep,name=emptyValues,proto3" json:"emptyValues,omitempty"`
 | 
			
		||||
	GeneratedFileId int64                     `protobuf:"varint,6,opt,name=generatedFileId,proto3" json:"generatedFileId,omitempty"`
 | 
			
		||||
	GeneratedAt     int64                     `protobuf:"varint,7,opt,name=generatedAt,proto3" json:"generatedAt,omitempty"`
 | 
			
		||||
	IsFinished      bool                      `protobuf:"varint,8,opt,name=isFinished,proto3" json:"isFinished,omitempty"`
 | 
			
		||||
	CreatedAt       int64                     `protobuf:"varint,9,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
 | 
			
		||||
	CountryNames    []string                  `protobuf:"bytes,10,rep,name=countryNames,proto3" json:"countryNames,omitempty"`
 | 
			
		||||
	Provinces       []*IPLibraryFile_Province `protobuf:"bytes,11,rep,name=provinces,proto3" json:"provinces,omitempty"`
 | 
			
		||||
	Cities          []*IPLibraryFile_City     `protobuf:"bytes,12,rep,name=cities,proto3" json:"cities,omitempty"`
 | 
			
		||||
	Towns           []*IPLibraryFile_Town     `protobuf:"bytes,13,rep,name=towns,proto3" json:"towns,omitempty"`
 | 
			
		||||
	ProviderNames   []string                  `protobuf:"bytes,14,rep,name=providerNames,proto3" json:"providerNames,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) Reset() {
 | 
			
		||||
@@ -80,6 +85,13 @@ func (x *IPLibraryFile) GetId() int64 {
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetName() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Name
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetFileId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.FileId
 | 
			
		||||
@@ -87,6 +99,34 @@ func (x *IPLibraryFile) GetFileId() int64 {
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetTemplate() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Template
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetEmptyValues() []string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.EmptyValues
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetGeneratedFileId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.GeneratedFileId
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetGeneratedAt() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.GeneratedAt
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *IPLibraryFile) GetIsFinished() bool {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.IsFinished
 | 
			
		||||
@@ -330,50 +370,60 @@ var File_models_model_ip_library_file_proto protoreflect.FileDescriptor
 | 
			
		||||
var file_models_model_ip_library_file_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69,
 | 
			
		||||
	0x70, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x9a, 0x05, 0x0a, 0x0d, 0x49, 0x50, 0x4c,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xb8, 0x06, 0x0a, 0x0d, 0x49, 0x50, 0x4c,
 | 
			
		||||
	0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
 | 
			
		||||
	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69,
 | 
			
		||||
	0x6c, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65,
 | 
			
		||||
	0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64,
 | 
			
		||||
	0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68,
 | 
			
		||||
	0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18,
 | 
			
		||||
	0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
 | 
			
		||||
	0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73,
 | 
			
		||||
	0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e,
 | 
			
		||||
	0x61, 0x6d, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65,
 | 
			
		||||
	0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c,
 | 
			
		||||
	0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69,
 | 
			
		||||
	0x6e, 0x63, 0x65, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2e,
 | 
			
		||||
	0x0a, 0x06, 0x63, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16,
 | 
			
		||||
	0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c,
 | 
			
		||||
	0x65, 0x2e, 0x43, 0x69, 0x74, 0x79, 0x52, 0x06, 0x63, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2c,
 | 
			
		||||
	0x0a, 0x05, 0x74, 0x6f, 0x77, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e,
 | 
			
		||||
	0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65,
 | 
			
		||||
	0x2e, 0x54, 0x6f, 0x77, 0x6e, 0x52, 0x05, 0x74, 0x6f, 0x77, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0d,
 | 
			
		||||
	0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x09, 0x20,
 | 
			
		||||
	0x03, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d,
 | 
			
		||||
	0x65, 0x73, 0x1a, 0x50, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x20,
 | 
			
		||||
	0x0a, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
 | 
			
		||||
	0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65,
 | 
			
		||||
	0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
 | 
			
		||||
	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65,
 | 
			
		||||
	0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x68, 0x0a, 0x04, 0x43, 0x69, 0x74, 0x79, 0x12, 0x20, 0x0a, 0x0b,
 | 
			
		||||
	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
 | 
			
		||||
	0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16,
 | 
			
		||||
	0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
 | 
			
		||||
	0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
 | 
			
		||||
	0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
 | 
			
		||||
	0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65,
 | 
			
		||||
	0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61,
 | 
			
		||||
	0x6c, 0x75, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
 | 
			
		||||
	0x64, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x67,
 | 
			
		||||
	0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x20,
 | 
			
		||||
	0x0a, 0x0b, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20,
 | 
			
		||||
	0x01, 0x28, 0x03, 0x52, 0x0b, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
 | 
			
		||||
	0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x08,
 | 
			
		||||
	0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64,
 | 
			
		||||
	0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20,
 | 
			
		||||
	0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x22,
 | 
			
		||||
	0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0a,
 | 
			
		||||
	0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d,
 | 
			
		||||
	0x65, 0x73, 0x12, 0x38, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x73, 0x18,
 | 
			
		||||
	0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62,
 | 
			
		||||
	0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63,
 | 
			
		||||
	0x65, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x06,
 | 
			
		||||
	0x63, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70,
 | 
			
		||||
	0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e,
 | 
			
		||||
	0x43, 0x69, 0x74, 0x79, 0x52, 0x06, 0x63, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x05,
 | 
			
		||||
	0x74, 0x6f, 0x77, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x62,
 | 
			
		||||
	0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e, 0x54,
 | 
			
		||||
	0x6f, 0x77, 0x6e, 0x52, 0x05, 0x74, 0x6f, 0x77, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28,
 | 
			
		||||
	0x09, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73,
 | 
			
		||||
	0x1a, 0x50, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b,
 | 
			
		||||
	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
 | 
			
		||||
	0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22,
 | 
			
		||||
	0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02,
 | 
			
		||||
	0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61,
 | 
			
		||||
	0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03,
 | 
			
		||||
	0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x84,
 | 
			
		||||
	0x01, 0x0a, 0x04, 0x54, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74,
 | 
			
		||||
	0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f,
 | 
			
		||||
	0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f,
 | 
			
		||||
	0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 | 
			
		||||
	0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a,
 | 
			
		||||
	0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
 | 
			
		||||
	0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x77,
 | 
			
		||||
	0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x77,
 | 
			
		||||
	0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
	0x6d, 0x65, 0x1a, 0x68, 0x0a, 0x04, 0x43, 0x69, 0x74, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f,
 | 
			
		||||
	0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
 | 
			
		||||
	0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c,
 | 
			
		||||
	0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
 | 
			
		||||
	0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
 | 
			
		||||
	0x12, 0x1a, 0x0a, 0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
 | 
			
		||||
	0x28, 0x09, 0x52, 0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x84, 0x01, 0x0a,
 | 
			
		||||
	0x04, 0x54, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79,
 | 
			
		||||
	0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e,
 | 
			
		||||
	0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69,
 | 
			
		||||
	0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63,
 | 
			
		||||
	0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63,
 | 
			
		||||
	0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x77, 0x6e, 0x4e,
 | 
			
		||||
	0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x77, 0x6e, 0x4e,
 | 
			
		||||
	0x61, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
 | 
			
		||||
	0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ const (
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
// 国家/地区
 | 
			
		||||
type RegionCountry struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
 
 | 
			
		||||
@@ -842,7 +842,7 @@ var file_service_ip_library_proto_rawDesc = []byte{
 | 
			
		||||
	0x76, 0x69, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d,
 | 
			
		||||
	0x6d, 0x61, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d,
 | 
			
		||||
	0x61, 0x72, 0x79, 0x32, 0xa3, 0x05, 0x0a, 0x10, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72,
 | 
			
		||||
	0x61, 0x72, 0x79, 0x32, 0x99, 0x05, 0x0a, 0x10, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72,
 | 
			
		||||
	0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4f, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61,
 | 
			
		||||
	0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x62,
 | 
			
		||||
	0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79,
 | 
			
		||||
@@ -874,18 +874,17 @@ var file_service_ip_library_proto_rawDesc = []byte{
 | 
			
		||||
	0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x44,
 | 
			
		||||
	0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65,
 | 
			
		||||
	0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75,
 | 
			
		||||
	0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x4c, 0x0a, 0x0e, 0x6c, 0x6f,
 | 
			
		||||
	0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x47, 0x0a, 0x0e, 0x6c, 0x6f,
 | 
			
		||||
	0x6f, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x70,
 | 
			
		||||
	0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e,
 | 
			
		||||
	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f,
 | 
			
		||||
	0x6b, 0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
 | 
			
		||||
	0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x4f, 0x0a, 0x0f, 0x6c, 0x6f, 0x6f, 0x6b,
 | 
			
		||||
	0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x62,
 | 
			
		||||
	0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73,
 | 
			
		||||
	0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f,
 | 
			
		||||
	0x6b, 0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70,
 | 
			
		||||
	0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
 | 
			
		||||
	0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
	0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x52,
 | 
			
		||||
	0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b,
 | 
			
		||||
	0x75, 0x70, 0x49, 0x50, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
 | 
			
		||||
	0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x49, 0x50,
 | 
			
		||||
	0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
 | 
			
		||||
	0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -1172,10 +1171,8 @@ type IPLibraryServiceClient interface {
 | 
			
		||||
	// Deprecated: Do not use.
 | 
			
		||||
	// 删除IP库
 | 
			
		||||
	DeleteIPLibrary(ctx context.Context, in *DeleteIPLibraryRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
 | 
			
		||||
	// Deprecated: Do not use.
 | 
			
		||||
	// 查询某个IP信息
 | 
			
		||||
	LookupIPRegion(ctx context.Context, in *LookupIPRegionRequest, opts ...grpc.CallOption) (*LookupIPRegionResponse, error)
 | 
			
		||||
	// Deprecated: Do not use.
 | 
			
		||||
	// 查询一组IP信息
 | 
			
		||||
	LookupIPRegions(ctx context.Context, in *LookupIPRegionsRequest, opts ...grpc.CallOption) (*LookupIPRegionsResponse, error)
 | 
			
		||||
}
 | 
			
		||||
@@ -1238,7 +1235,6 @@ func (c *iPLibraryServiceClient) DeleteIPLibrary(ctx context.Context, in *Delete
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Deprecated: Do not use.
 | 
			
		||||
func (c *iPLibraryServiceClient) LookupIPRegion(ctx context.Context, in *LookupIPRegionRequest, opts ...grpc.CallOption) (*LookupIPRegionResponse, error) {
 | 
			
		||||
	out := new(LookupIPRegionResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/pb.IPLibraryService/lookupIPRegion", in, out, opts...)
 | 
			
		||||
@@ -1248,7 +1244,6 @@ func (c *iPLibraryServiceClient) LookupIPRegion(ctx context.Context, in *LookupI
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Deprecated: Do not use.
 | 
			
		||||
func (c *iPLibraryServiceClient) LookupIPRegions(ctx context.Context, in *LookupIPRegionsRequest, opts ...grpc.CallOption) (*LookupIPRegionsResponse, error) {
 | 
			
		||||
	out := new(LookupIPRegionsResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/pb.IPLibraryService/lookupIPRegions", in, out, opts...)
 | 
			
		||||
@@ -1275,10 +1270,8 @@ type IPLibraryServiceServer interface {
 | 
			
		||||
	// Deprecated: Do not use.
 | 
			
		||||
	// 删除IP库
 | 
			
		||||
	DeleteIPLibrary(context.Context, *DeleteIPLibraryRequest) (*RPCSuccess, error)
 | 
			
		||||
	// Deprecated: Do not use.
 | 
			
		||||
	// 查询某个IP信息
 | 
			
		||||
	LookupIPRegion(context.Context, *LookupIPRegionRequest) (*LookupIPRegionResponse, error)
 | 
			
		||||
	// Deprecated: Do not use.
 | 
			
		||||
	// 查询一组IP信息
 | 
			
		||||
	LookupIPRegions(context.Context, *LookupIPRegionsRequest) (*LookupIPRegionsResponse, error)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -5,14 +5,19 @@ package pb;
 | 
			
		||||
 | 
			
		||||
message IPLibraryFile {
 | 
			
		||||
	int64 id = 1;
 | 
			
		||||
	int64 fileId = 2;
 | 
			
		||||
	bool isFinished = 3;
 | 
			
		||||
	int64 createdAt = 4;
 | 
			
		||||
	repeated string countryNames = 5;
 | 
			
		||||
	repeated Province provinces = 6;
 | 
			
		||||
	repeated City cities = 7;
 | 
			
		||||
	repeated Town towns = 8;
 | 
			
		||||
	repeated string providerNames = 9;
 | 
			
		||||
	string name = 2;
 | 
			
		||||
	int64 fileId = 3;
 | 
			
		||||
	string template = 4;
 | 
			
		||||
	repeated string emptyValues = 5;
 | 
			
		||||
	int64 generatedFileId = 6;
 | 
			
		||||
	int64 generatedAt = 7;
 | 
			
		||||
	bool isFinished = 8;
 | 
			
		||||
	int64 createdAt = 9;
 | 
			
		||||
	repeated string countryNames = 10;
 | 
			
		||||
	repeated Province provinces = 11;
 | 
			
		||||
	repeated City cities = 12;
 | 
			
		||||
	repeated Town towns = 13;
 | 
			
		||||
	repeated string providerNames = 14;
 | 
			
		||||
 | 
			
		||||
	message Province {
 | 
			
		||||
		string countryName = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
// 国家/地区
 | 
			
		||||
message RegionCountry {
 | 
			
		||||
	int64 id = 1;
 | 
			
		||||
	string name = 2;
 | 
			
		||||
 
 | 
			
		||||
@@ -34,14 +34,10 @@ service IPLibraryService {
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// 查询某个IP信息
 | 
			
		||||
	rpc lookupIPRegion (LookupIPRegionRequest) returns (LookupIPRegionResponse) {
 | 
			
		||||
		option deprecated = true;
 | 
			
		||||
	};
 | 
			
		||||
	rpc lookupIPRegion (LookupIPRegionRequest) returns (LookupIPRegionResponse);
 | 
			
		||||
 | 
			
		||||
	// 查询一组IP信息
 | 
			
		||||
	rpc lookupIPRegions (LookupIPRegionsRequest) returns (LookupIPRegionsResponse) {
 | 
			
		||||
		option deprecated = true;
 | 
			
		||||
	};
 | 
			
		||||
	rpc lookupIPRegions (LookupIPRegionsRequest) returns (LookupIPRegionsResponse);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 创建IP库
 | 
			
		||||
 
 | 
			
		||||
@@ -11,9 +11,11 @@ import "models/model_region_city.proto";
 | 
			
		||||
import "models/model_region_town.proto";
 | 
			
		||||
import "models/model_region_provider.proto";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// IP库文件管理
 | 
			
		||||
service IPLibraryFileService {
 | 
			
		||||
	// 查找所有已完成的IP库文件
 | 
			
		||||
	rpc findAllFinishedIPLibraryFiles(FindAllFinishedIPLibraryFilesRequest) returns (FindAllFinishedIPLibraryFilesResponse);
 | 
			
		||||
 | 
			
		||||
	// 查找所有未完成的IP库文件
 | 
			
		||||
	rpc findAllUnfinishedIPLibraryFiles(FindAllUnfinishedIPLibraryFilesRequest) returns (FindAllUnfinishedIPLibraryFilesResponse);
 | 
			
		||||
 | 
			
		||||
@@ -40,6 +42,21 @@ service IPLibraryFileService {
 | 
			
		||||
 | 
			
		||||
	// 生成IP库文件
 | 
			
		||||
	rpc generateIPLibraryFile(GenerateIPLibraryFileRequest) returns (RPCSuccess);
 | 
			
		||||
 | 
			
		||||
	// 设置某个IP库为已完成
 | 
			
		||||
	rpc updateIPLibraryFileFinished(UpdateIPLibraryFileFinishedRequest) returns (RPCSuccess);
 | 
			
		||||
 | 
			
		||||
	// 删除IP库文件
 | 
			
		||||
	rpc deleteIPLibraryFile(DeleteIPLibraryFileRequest) returns (RPCSuccess);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查找所有已完成的IP库文件
 | 
			
		||||
message FindAllFinishedIPLibraryFilesRequest {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message FindAllFinishedIPLibraryFilesResponse {
 | 
			
		||||
	repeated IPLibraryFile ipLibraryFiles = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查找所有未完成的IP库文件
 | 
			
		||||
@@ -62,14 +79,15 @@ message FindIPLibraryFileResponse {
 | 
			
		||||
 | 
			
		||||
// 创建IP库文件
 | 
			
		||||
message CreateIPLibraryFileRequest {
 | 
			
		||||
	string template = 1;
 | 
			
		||||
	repeated string emptyValues = 2;
 | 
			
		||||
	int64 fileId = 3;
 | 
			
		||||
	bytes countriesJSON = 4;
 | 
			
		||||
	bytes provincesJSON = 5;
 | 
			
		||||
	bytes citiesJSON = 6;
 | 
			
		||||
	bytes townsJSON = 7;
 | 
			
		||||
	bytes providersJSON = 8;
 | 
			
		||||
	string name = 1;
 | 
			
		||||
	string template = 2;
 | 
			
		||||
	repeated string emptyValues = 3;
 | 
			
		||||
	int64 fileId = 4;
 | 
			
		||||
	bytes countriesJSON = 5;
 | 
			
		||||
	bytes provincesJSON = 6;
 | 
			
		||||
	bytes citiesJSON = 7;
 | 
			
		||||
	bytes townsJSON = 8;
 | 
			
		||||
	bytes providersJSON = 9;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message CreateIPLibraryFileResponse {
 | 
			
		||||
@@ -156,3 +174,13 @@ message CheckProvidersWithIPLibraryFileIdResponse {
 | 
			
		||||
message GenerateIPLibraryFileRequest {
 | 
			
		||||
	int64 ipLibraryFileId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 设置某个IP库为已完成
 | 
			
		||||
message UpdateIPLibraryFileFinishedRequest {
 | 
			
		||||
	int64 ipLibraryFileId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 删除IP库文件
 | 
			
		||||
message DeleteIPLibraryFileRequest {
 | 
			
		||||
	int64 ipLibraryFileId = 1;
 | 
			
		||||
}
 | 
			
		||||
@@ -6,7 +6,7 @@ package pb;
 | 
			
		||||
import "models/model_region_country.proto";
 | 
			
		||||
import "models/rpc_messages.proto";
 | 
			
		||||
 | 
			
		||||
// 国家相关服务
 | 
			
		||||
// 国家/地区相关服务
 | 
			
		||||
service RegionCountryService {
 | 
			
		||||
	// 查找所有的国家/地区列表
 | 
			
		||||
	rpc findAllEnabledRegionCountries (FindAllEnabledRegionCountriesRequest) returns (FindAllEnabledRegionCountriesResponse) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user