gufodao

package
v1.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Copyright 2020 Alexey Yanchenko <mail@yanchenko.me>

This file is part of the Gufo library.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var AesKey = []byte("H4fnCsMf4vbE60nK")

AesKey is salt for pasword hash

View Source
var Configpath string = "/var/gufo/config/"
View Source
var DBConnectionv2 = &DBv2{}

Connection instance

Functions

func AnsDef

func AnsDef(i int)

func AnsNo

func AnsNo()

func AskForConfigFile

func AskForConfigFile(i int)

func CheckConfig

func CheckConfig()

CheckConfig() Check configuration file and stop app if config file mot foud or has errors

func CheckForFlags

func CheckForFlags()

func CheckForSign added in v1.11.5

func CheckForSign()

CheckForSign - check Gufo Sign and if it missing, generate a sign. Sign need to connect to micoservices. By this Sign Microservices understand that requests are from one system

func ConfigString

func ConfigString(conf string) string

func ConvertAnyToInterface

func ConvertAnyToInterface(anyValue *anypb.Any) (interface{}, error)

func ConvertInterfaceToAny

func ConvertInterfaceToAny(v interface{}) (*anypb.Any, error)

func CreateConfig

func CreateConfig()

func CreateGravatar added in v1.15.1

func CreateGravatar(data []byte, length, blockLength int) image.Image

func DBCheck

func DBCheck() bool

func DecryptConfigPasswords

func DecryptConfigPasswords(pwd string) string

DecryptConfigPasswords - Decrypt Hashed password in settings file to real password

func DerefString

func DerefString(s *string) string

func EncryptConfigPassword

func EncryptConfigPassword(pwd string) (string, error)

func ErrorReturn added in v1.11.5

func ErrorReturn(t *pb.Request, httpcode int, code string, message string) (response *pb.Response)

func GRPCConnect added in v1.14.0

func GRPCConnect(host string, port string, t *pb.Request) (answer map[string]interface{})

func GRPCDelete added in v1.12.2

func GRPCDelete(misroservice string, param string, paramid string, args map[string]interface{}, token string, sign string) map[string]interface{}

func GRPCGen added in v1.12.4

func GRPCGen(misroservice string, param string, paramid string, args map[string]interface{}, token string, method string, sign string) map[string]interface{}

func GRPCGet added in v1.12.2

func GRPCGet(misroservice string, param string, paramid string, args map[string]interface{}, token string, sign string) map[string]interface{}

func GRPCPatch added in v1.12.4

func GRPCPatch(misroservice string, param string, paramid string, args map[string]interface{}, token string, sign string) map[string]interface{}

func GRPCPost added in v1.12.2

func GRPCPost(misroservice string, param string, paramid string, args map[string]interface{}, token string, sign string) map[string]interface{}

func GRPCPut added in v1.12.2

func GRPCPut(misroservice string, param string, paramid string, args map[string]interface{}, token string, sign string) map[string]interface{}

func GRPCReq added in v1.12.2

func GRPCReq(misroservice string, param string, paramid string, args map[string]interface{}, token string, method string, sign string) map[string]interface{}

func GRPCTrace added in v1.12.4

func GRPCTrace(misroservice string, param string, paramid string, args map[string]interface{}, token string, sign string) map[string]interface{}

func GenString

func GenString(n int, alphanum string) string

GenerateStr func

func GetLogDir

func GetLogDir() string

func GetPass

func GetPass(conf string) string

func HashConfigPasswords

func HashConfigPasswords()

HashConfigPasswords - Change password in settings file to hash

func Hashgen

func Hashgen(n int) string

func InitCache

func InitCache()

func Int32

func Int32(v int) *int32

func Interfacetoresponse

func Interfacetoresponse(request *pb.Request, answer map[string]interface{}) (response *pb.Response)

func JsonGet added in v1.12.3

func JsonGet(url string, args map[string]interface{}, token string, tokentype string, tokenheader string) ([]byte, error)

func JsonReq added in v1.12.3

func JsonReq(url string, args map[string]interface{}, token string, tokentype string, tokenheader string, method string) ([]byte, error)

func Numgen

func Numgen(n int) string

func Pad

func Pad(src []byte) []byte

func RandomString

func RandomString(l int) string

func ReadUserIP

func ReadUserIP(r *http.Request) string

requestGetRemoteAddress returns ip address of the client making the request, taking into account http proxies

func SendHTMLEmail

func SendHTMLEmail(to string, title string, link []string, subject string, templ string, attach []string, ms *MailSettings)

func SetErrorLog

func SetErrorLog(value string)

func SetLog

func SetLog(value string)

func Stringen

func Stringen(n int) string

func ToMapStringAny

func ToMapStringAny(v map[string]interface{}) map[string]*anypb.Any

func ToMapStringInterface

func ToMapStringInterface(v map[string]*anypb.Any) map[string]interface{}

func Unpad

func Unpad(src []byte) ([]byte, error)

func WriteLog

func WriteLog(value string, p string)

Types

type DBv2

type DBv2 struct {
	Conn *gorm.DB
}

func ConnectDBv2

func ConnectDBv2() (*DBv2, error)

GetConnection - connect to DB

func DBConnectv2

func DBConnectv2() (*DBv2, error)

type MailRequest

type MailRequest struct {
	// contains filtered or unexported fields
}

Request struct

func NewRequest

func NewRequest(to []string, subject, body string, attach []string) *MailRequest

func (*MailRequest) ParseTemplate

func (r *MailRequest) ParseTemplate(templateFileName string, data interface{}) error

func (*MailRequest) SendEmail

func (r *MailRequest) SendEmail(ms *MailSettings) (bool, error)

type MailSettings

type MailSettings struct {
	Custom  bool
	Host    string
	Port    string
	User    string
	Pass    string
	Address string
	Reply   string
	Title   string
}

type Response

type Response struct {
	Data      map[string]interface{} `json:"data"`
	Session   map[string]interface{} `json:"session"`
	TimeStamp int                    `json:"timestamp"`
	Language  string                 `json:"lang"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL