Fix log import (#1957)

This commit is contained in:
澄潭
2025-03-26 20:27:53 +08:00
committed by GitHub
parent f83e66c23b
commit ea0143829d
80 changed files with 339 additions and 402 deletions

View File

@@ -8,7 +8,6 @@ import (
_ "embed"
"github.com/alibaba/higress/plugins/wasm-go/pkg/log"
"github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm"
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm/types"
@@ -57,7 +56,7 @@ type GeoIpData struct {
Isp string `json:"isp"`
}
func parseConfig(json gjson.Result, config *GeoIpConfig, log log.Log) error {
func parseConfig(json gjson.Result, config *GeoIpConfig, log wrapper.Log) error {
sourceType := json.Get("ip_source_type")
if sourceType.Exists() && sourceType.String() != "" {
switch sourceType.String() {
@@ -105,7 +104,7 @@ func parseConfig(json gjson.Result, config *GeoIpConfig, log log.Log) error {
return nil
}
func ReadGeoIpDataToRdxtree(log log.Log) error {
func ReadGeoIpDataToRdxtree(log wrapper.Log) error {
GeoIpRdxTree = iptree.New()
//eg., cidr country province city isp
@@ -142,7 +141,7 @@ func ReadGeoIpDataToRdxtree(log log.Log) error {
}
// search geodata using client ip in radixtree.
func SearchGeoIpDataInRdxtree(ip string, log log.Log) (*GeoIpData, error) {
func SearchGeoIpDataInRdxtree(ip string, log wrapper.Log) (*GeoIpData, error) {
val, found, err := GeoIpRdxTree.GetByString(ip)
if err != nil {
log.Errorf("search geo ip data in raditree failed. %v %s", err, ip)
@@ -197,7 +196,7 @@ func isInternalIp(ip string) (string, error) {
return "", nil
}
func onHttpRequestHeaders(ctx wrapper.HttpContext, config GeoIpConfig, log log.Log) types.Action {
func onHttpRequestHeaders(ctx wrapper.HttpContext, config GeoIpConfig, log wrapper.Log) types.Action {
var (
s string
err error