constbot

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtnClose    string = "close"
	BtnBack     string = "back"
	BtnConform  string = "conform"
	BtnCancle   string = "cancle"
	BtnContinue string = "continue"
)

common

View Source
const (
	BtnChangeName   string = "Change Name"
	BtnChangeIn     string = "change inbound"
	BtnChangeOut    string = "change outbound"
	BtnDelete       string = "delete config"
	BtnHome         string = "home"
	BtnUsageHistory string = "Ful Usage History"
	BtnChangeQuota  string = "Change Quota"
	BtnChangeLogin  string = "Change Login"
)

Configure

View Source
const (
	BtnUserInfo  string = "UserInfo"
	BtnConfigs   string = "Configs"
	BtnFullInfo  string = "full info"
	BtnFullUsage string = "Get Full Usage Alltime"

	BtnCheckOutbounds string = "Outbounds"
	BtnCheckInbounds  string = "Inbounds"
)

Info

View Source
const (
	BtnChannel string = "Join Channel"
	BtnGroup   string = "Join Group"
	BtnBot     string = "Bot"
)

Urls

View Source
const (
	Btncommand     string = "Commands"
	BtnBtinfo      string = "Bot Info"
	BtnBuilderHelp string = "Builder Help"
	BtnFaq         string = "FAQ"

	BtnNext string = "next"

	BtnAbout    string = "About"
	BtnTutorial string = "Tutorial"

	BtnCloseConn string = "Close Conns"
)
View Source
const (
	BtnCheck   string = "check"
	BtnClaim   string = "claim"
	BtnGetLink string = "GetLink"
)

refral

View Source
const (
	BtnInfo string = "info"
	BtnBuy  string = "buy points"
)

points

View Source
const (
	//user service
	CmdStart      = "start"
	CmdHelp       = "help"
	CmdSugess     = "suggest"
	CmdContact    = "contact"
	CmdEvents     = "events"
	CmdRefer      = "refer"
	CmdGift       = "sendgift"
	CmdCap        = "setcap"
	CmdDistribute = "distribute"
	CmdPoints     = "points"
	CmdRecheck    = "recheck"
	CmdSource     = "source"
	CmdFree       = "free"
	CmdCancel     = "cancel"

	//xraywiz
	CmdInfo      = "getinfo"
	CmdStatus    = "status"
	CmdCreate    = "create"
	CmdConfigure = "configure"
	CmdBuild     = "buildconf"

	//special for parser
	CmdNull = "nullcmd"

	//admin
	CmdBrodcast    = "broadcast"
	CmdUserInfo    = "getuser"
	CmdServerInfo  = "serverinfo"
	CmdChatSession = "chat"
	CmdOverview    = "overview"
	CmdRefreshDb   = "refreshdb"
	CmdSwitch      = "switch"
)
View Source
const (
	Groupservicename    string = "groupsrv"
	Adminservicename    string = "adminsrv"
	Callbackservicename string = "callback"
	Userservicename     string = "usersrv"
	Xraywizservicename  string = "xraywiz"
	Defaultservicename  string = "defaultsrv"
	InlineServiceName   string = "inline"

	DefaultPoint int64 = 10

	Channel string = "channel"
	Group   string = "group"

	Inbound  string = "inbound"
	Outbound string = "outbound"

	Statusmember string = "member"
	Statusleft   string = "left"
	Statuskicked string = "kicked"

	AsKB Bwidth = 1024
	AsMB Bwidth = AsKB * AsKB
	AsGB Bwidth = AsKB * AsMB

	GBtoByte Bwidth = 1024 * 1024 * 1024
	MBtoByte Bwidth = 1024 * 1024
	KBtoByte Bwidth = 1024

	KB string = "KB"
	MB string = "MB"
	GB string = "GB"

	Dbbatchsize int = 100

	Vless  string = "vless"
	Trojan string = "trojan"
	Common string = "common"
	Direct string = "direct"

	UpdateTimeout = 4 * time.Minute

	MaxLoginLimit int = 5

	CmdConfigBlocks string = "confblocks"

	//ParseModes
	ParseHtml       string = "html"
	ParseMarkdown   string = "mdw1"
	ParseMarkdownv2 string = "mdw2"

	HelpPags    int16 = 3
	InfoPage    int16 = 4
	BuilderPage int16 = 5

	//Mediatypes
	MedVideo string = "video"
	MedPhoto string = "photo"
	MedAudio string = "audio"

	//apimethods
	ApiMethodCaptionEdit   string = "editMessageCaption"
	ApiMethodEdimgmed      string = "editMessageMedia"
	ApiMethodEditText      string = "editMessageText"
	ApiMethodSendMG        string = "sendMessage"
	ApiMethodSendPhoto     string = "sendPhoto"
	ApiMethodSendVid       string = "sendVideo"
	ApiMethodAnswereInline string = "answerInlineQuery"

	SkipDelim string = "."

	MaxCharacterMg = 4096
)
View Source
const (
	TmpConfiConfigure string = "conf_configure" // msg before change config, para - {{.Name}}
	TmplConfigureHome string = "configure_home"
	TmpInchange       string = "conf_in_change"
	TmpOutchange      string = "conf_out_change"
	TmpConQuota       string = "conf_quota_change"
	TmpNameChange     string = "conf_name_change" // msg when user change name of the configvia configurecommand, para - {{.Name}}

)

command configure

View Source
const (
	TmpCrAlreadyHave string = "create_conf_limit"
	TmpCrAvblQuota   string = "create_available_quota"
	TmpCrSendUID     string = "create_result"
	TmpCrInInfo      string = "create_in_info"
	TmpCrOutInfo     string = "create_out_info"
	TmplCrSelect     string = "create_select"
)

CommandCreate

View Source
const (
	TmpStTotal    string = "status_home"
	TmpStcallback string = "status_callback"
)

CommandStatus

View Source
const (
	TmpcapQuota string = "setcap_already"
	TmpcapWarn  string = "setcap_warn"
	Tmpcapreply string = "setcap_get"
)

cap

View Source
const (
	TmpGifSend  string = "gift_send"
	TmplRecived string = "gift_reciver"
)

Gift

View Source
const (
	TmpChatmemLeft         string = "chat_mem_left"
	TmpGroupWelcome        string = "grp_welcome"
	TmpWelcomeInbox        string = "dm_welcome"
	TmplInboxVerified      string = "dm_verified"
	TmplInboxVerifiedAgain string = "dm_verified_again"
	TmpGrpComeback         string = "grp_comeback"  //user who is not in channel join group
	TmpChanComeback        string = "chan_comeback" //user who is not in channel join group
	TmpChannelWelcome      string = "chan_welcome"
)

Chatmemupdate

View Source
const (
	TmpHelpHome         string = "help_home"
	TmpHelpCmPage       string = "help_cmd"  // this does not use directly istead TmpPage + pagenum
	TmpHelpInfoPage     string = "help_info" // this does not use directly istead TmpPage + pagenum
	TmplHelpBuilderHelp string = "help_builder"
	TmplHelpTuto        string = "help_tutorial"
	TmpAbout            string = "help_about"
)

help

View Source
const (
	TmpNewUsers             string = "start_newuser"
	TmpNewUsersVerified     string = "start_newuser_verified"
	TmplUserUnverifiedStart string = "start_newuser_unverified"

	TmpregularVerified string = "start_regular"

	TmplMonthLimited string = "start_monthlimited"
	TmpRemUserst     string = "start_removed"
	TmpRestrcistr    string = "start_restricted"
)

start

View Source
const (
	TmpRefHome  string = "refer_home"
	TmpRefshare string = "refer_share"
)

refer

View Source
const (
	TmplGetinfoHome string = "getinfo_home"
	TmpUserInfo     string = "getinfo_user"
	TmplOutInfo     string = "getinfo_out"
	TmplInInfo      string = "getinfo_in"
	TmpConfigInfo   string = "getinfo_usage"
)

getinfo

View Source
const (
	UserLstAll          string = "alluser"
	UserLstTempLimited  string = "templimited"
	UserLstMonthLimited string = "monthlimited"
	UserLstActive       string = "active"
	UserLstGroup        string = "user_in_group"
	UserLstDistributed  string = "distributed_user"
	UserLstVerified     string = "verified"
	UserLstUnVerified   string = "unverified"
	UserLstRestricted   string = "restricted_user"
)
View Source
const (
	BtnBuilderCreateConfig string = "🔰 Create Config 🔰"
)
View Source
const (
	CreatePoint = 2
)
View Source
const (
	TmpDisGroup string = "distribute_group"
)

distribute

View Source
const (
	TmplBuilderHome string = "builder_home"
)
View Source
const (
	TmplCommonUnverified string = "com_unverified"
)

common

View Source
const (
	TmplEventHome string = "event_home"
)

events

View Source
const (
	TmplPoints string = "points_home"
)

points

Variables

View Source
var (
	ErrCommandNotfound    = errors.New("command not found")
	ErrUserMonthLimited   = errors.New("this month limited for the user")
	ErrUserNotVerified    = errors.New("user is not verified user")
	ErrUserIsNotinPrivate = errors.New("user is not private")
	ErrUserIsRestricted   = errors.New("restricted user")
	ErrUserTempLimited    = errors.New("templimited user")

	ErrUpdateFaile = errors.New("recived updated has nothing to process")
)

Parser

View Source
var (
	MsgserverErr string = "🚨 Something went wrong on the server. Please try again later."

	// Configure //
	MsgNoconfigstochange string = "⚙️ You don't have any configurations to modify. Please use the /create command to set up your configurations."
	//MsgConfChoose        string = "🛠️ Please choose the configuration you want to edit."
	MsgNewName          string = "✏️ Enter a new name for the configuration."
	MsgInAlredSelected  string = "Already This Inbound selected"
	MsgOutAlredSelected string = "Already This OUtbound selected"
	// Name change //
	MsgNamechangeSuc    string = "✅ Configuration name changed successfully!"
	MsgNameChangeFailed string = "❌ Failed to change the configuration name."

	// Change inbound //
	MsgInsel          string = "📥 Select the inbound configuration to change."
	MsgInchanGeWarn   string = "" /* 171-byte string literal not displayed */
	MsgInchangesucses string = "✅ Inbound configuration successfully changed!"

	// Change outbound //
	Msgoutsel         string = "📤 Select the outbound configuration to change."
	MsgOutchangeWar   string = "⚠️ Warning: Changing the outbound configuration will modify your IP address."
	MsOutchangesucses string = "✅ Outbound configuration successfully changed!"

	// Delete configuration //
	MsgdelConnWarn string = "⚠️ Your connection will be closed."
	MsgSure        string = "❓ Are you sure? Your connection will be lost."
	MsgdelFail     string = "❌ Failed to delete the configuration."
	MsgdelSuccses  string = "✅ Configuration deleted successfully!"

	// Quota //
	MsgCoQuota       string = "✅ Configuration quota successfully updated!"
	MsgQuotawarn     string = "⚠️ Your quota must be within the specified range."
	MsgQuotawarnlow  string = "⚠️ Your quota must be greater than you'r current usage"
	MsgQuotawarnzero string = "⚠️ Value should be greater than zero"
)
View Source
var (
	// Common
	MsgSessionExcist   string = "⚠️ A session already exists. Please close it first."
	Msgwrong           string = "❌ Something went wrong. Please try again."
	MsgwrongtAdmmin    string = "❌ Something went wrong. Please retry, or contact the admin with the error."
	MsgConfUnfoun      string = "⚙️ Configuration not found. Please retry."
	MsgSessionOver     string = "⏳ Your session has ended. Please try again."
	MsgSessionFail     string = "❌ Session creation failed. Please try again later."
	MsgContextDead     string = "❌ Context canceled. Please try again."
	MsgValidName       string = "🔑 Please send a valid name, no commands allowed."
	MsgValidInt        string = "🔢 Please send a valid integer."
	Msgretryfail       string = "🚫 මෝඩයෙක් බව පෙන්නනන හදන්න එපා"
	MsgRecursionExceed string = "" /* 153-byte string literal not displayed */
	MsgDberr           string = "❌ A database error occurred. Please try again later."
	MsgUserNotFoun     string = "👤 User not found. The user may not have registered with the bot."
	MsgTargetcapped    string = "🚫 Target user is a capped user."

	MsgNotCmdDIs string = ""

	// Others
	ButtonSelectEmjoi   string = " ✅"
	MsgUserMonthLimited string = "🚫 You can't use this service until your punishment period is over."
)
View Source
var (
	//MsgInfoStart        string = "👋 Hello! How are you? What would you like to do?"
	MsgInfoNoconfigs    string = "⚙️ You don't have any configurations."
	MsgInfoSelectConfig string = "🔧 Select a configuration to reveal its information."

	// Configs
	Msgconfcannotfind string = "❌ Configuration not found. Something went wrong. You may need to notify the admin if this continues."
	MsgfetchUsage     string = "⏳ Please wait while we fetch your usage history. This may take a moment."
)
View Source
var (
	MsgVerifiedUser string = "🔒 You need to be a verified user first. Please join our group and channel, then try again."
	MsgUsageExceed  string = "❌ You can create configurations, but you will not be able to use them as your quota is exceeded."
	MsgselectIn     string = "📥 Select an inbound configuration to create. You can change the inbound later."
	MsgselectOut    string = "" /* 205-byte string literal not displayed */
	MsgnoQuota      string = "⚠️ You don't have available quota to add to this configuration. Please change the quota of another configuration."
	MsgGetName      string = "🔑 Please provide a name for the configuration."
	MsgCrFailed     string = "❌ Configuration creation failed. Please try again later."
	MsgInternalErr  string = "⚠️ Internal VPN server error. You may need to contact the admin."
	MsgGetSni       string = "🔑 Please provide your SNI (you can change this later yourself)."
	MsgCrsuccsess   string = "✅ You have successfully created the configuration."
	MsgCrLogin      string = "" /* 131-byte string literal not displayed */
	MsgCrLoginwarn  string = "⚠️ Login limit should be between 0 and 5."
	MsgSnifail      string = "" /* 126-byte string literal not displayed */
	MsgCrConfigIn   string = "🛠️ You can create configuration blocks using the /" + CmdConfigBlocks + " command."
	MsgCrdisuser    string = "⚠️ You can't create configurations at the moment. You are a restricted user."

	MsgCrInerr  string = "❌ The selected inbound configuration has a fatal error."
	MsgCrOuterr string = "❌ The selected outbound configuration has a fatal error."

	MsgCrQuotaNote string = "" /* 243-byte string literal not displayed */

	MsgNoQuota = "" /* 148-byte string literal not displayed */
)

Command Create

View Source
var (
	MsgStVerify   string = "🔒 You are not a verified user. In order to see the status or access any Singbox services, you need to be a verified user."
	MsgStNoconfig string = "⚙️ You don't have any configurations. To get usage, please create configs using the /create command."
)

Command Status

View Source
var (
	Msgcapverify  string = "🔒 You need to be a verified user in order to distribute your bandwidth."
	MsgcapAlready string = "⚠️ You are already capped. You can't cap again. Please wait until your cap time limit is over."
	Msgcapexced   string = "❌ You can't cap your quota because you've already used all of your quota."
	Msgcapzerod   string = "⚠️ The cap cannot be zero. If you want to share your total bandwidth, please use the /distribute command."
	MsgcapThan    string = "⚠️ Please enter a value lower than your available quota."
	MsgcapConform string = "⚠️ You are about to cap your quota. This quota will be valid for the next 30 days."
	MsgcapCancle  string = "❌ Capping your quota has been canceled."
	MsgcapSuccses string = "✅ You have successfully capped your quota."

	MsgcapUsage string = "⚠️ You have already used the cap you entered. Please enter a cap higher than your usage."

	MsgcapRecalFail string = "⚠️ Recalculation Failed, You'r quota will update in next db refresh"

	MsgCannotCap string = "MsgCannotCap"
)

User Cap

View Source
var (
	MsgDisAlready    string = "⚠️ You are already a distributed user. You can't distribute again."
	MsgDisneedVerify string = "🔒 You need to be a verified user in order to distribute your bandwidth."
	MsgDisConform    string = "⚠️ Are you sure? You are about to distribute all of your quota."
	MsgDisSucsess    string = "✅ You have successfully distributed your quota. Thank you!"
	MsgDisCapped     string = "⚠️ You are capped user. You can't distribute"
)

User Distribute

View Source
var (
	MsgTempMonth        = "MsgTempMonth"
	MsgFree             = "MsgFree"
	MsgTempMonthLimited = "MsgTempMonthLimited"
	MsgTempNoLimit      = "MsgTempNoLimit"
	MsgTempLimitAlert   = "MsgTempLimitAlert"
)
View Source
var (
	MsgGifVerify      string = "🔒 You need to be a verified user in order to send gifts."
	MsgGifUsercap     string = "⚠️ You can't send gifts as you are a capped user. Please wait until your cap is over."
	MsgGifrec         string = "🎁 You have received a gift from someone, so you can't send one right now."
	MsgGifsend        string = "⚠️ You have already sent a gift. You can't send any more gifts until 30 days have passed."
	Msggifterr        string = "❌ You can't gift more than what you have."
	MsgGifreciver     string = "🎁 Alright, now send me the recipient's Telegram ID or username. If you want to cancel, send /cancel."
	MsgGiftcancle     string = "❌ Sending the gift has been canceled."
	MsgGifRecnOconfig string = "⚠️ The target user does not have any created config. They need to have configs in order to receive gifts."
)

User Conform

View Source
var (
	MsgChatMemLeft string = ""
	MsgBannedMem   string = "👋 Bye Bye!"
)
View Source
var (
	Msghelpnoverify string = "🔒 This service is only available for verified users."
	MsgCallbackFaq  string = "💬 Ehema pasna na thama." // Assuming this is intentional in a local language; if not, let me know for clarification.
	MsgHeloClosed   string = "❌ Help is closed."
)

Help

View Source
var (
	//MsgUserRemoved   string = "You are a removed user. If you want to use the connected service again, please join with us."
	MsgsttInChan     string = "🔔 You are already in the channel, but to use this bot, you may need to join the group."
	MsgstartGrpin    string = "🔔 You are already in our group. To use this service, you need to join our channel."
	Msgstartmlimited string = "⏳ You didn't use 3/4 of your quota from last month, so you can't use the service for the next 30 days."
	MsgBannedUser    string = "🚫 You are a banned user. Please contact the admin to be unbanned."

	// Referral handling
	MsgSelfRef        string = "❌ You can't be your own referral."
	MsgRefOwenerNFoun string = "⚠️ Something went wrong fetching the owner of the referral. The referral owner may not be registered."
	Msgcanref         string = "📢 You can also refer users and earn rewards. Use /refer for more info."
	MsgRefAlredy      string = "you cant be a reffred user, you are already reffred you are refred from user id %v"
	MsgReferd         string = "" /* 128-byte string literal not displayed */
)

Start

View Source
var (
	MsgRefVerify       string = "🔒 You can't use this command unless you're a verified user. Please join the channel and group, then try again."
	MsgRefNousers      string = "⚠️ You don't have any referred users yet. Hurry up and refer users!"
	MsgRefNoUser       string = "" /* 127-byte string literal not displayed */
	MsgRefClaimNote    string = "ℹ️ You can claim referrals as points: Verified user = 2 points, Normal user = 1 point."
	MsgRefClaimConform string = "✅ Confirm to claim your referral points."
	MsgRefClaimError   string = "❌ Error processing claim. Please try again."

	MsgRefClaimed           string = "🎉 You have claimed %v points."
	MSgRefClaimAllunsupport string = "⚠️ Claim all feature is not supported yet."
	MsgClaimCancle          string = "❌ Claim canceled."
	MsgRefLink              string = "🔗 Your referral link is: %v"
	MsgRefNoANyUser         string = "⚠️ You don't have any referred users."
)

Refer

View Source
var (
	MsgSugess     string = "💡 Please share your suggestion! We’d love to hear your thoughts and ideas. 😊"
	Msgsugessdone string = "✅ Suggestion submitted! 📩 It will be sent to the admin for review. Thank you for your input! 🙏"
)

Suggest

View Source
var (
	MsgQuotanotUsed      string = "" /* 181-byte string literal not displayed */
	MsgDistributeOver    string = "" /* 193-byte string literal not displayed */
	MsgwtchErrinnotfound string = "" /* 159-byte string literal not displayed */

	MsgwtchErrtypemiss string = "" /* 158-byte string literal not displayed */
	MsgwtchErruseradd  string = "" /* 177-byte string literal not displayed */

	MsgwtchUsagereset string = "🔄 All your usage has been reset, but any excess usage has been carried over to this month. 📊"
	MsgresetUsage     string = "🔄 All your usage has been successfully reset. ✨"

	MsgNoInbound string = "Something Wrong Inbound Can't be found you may need to contact admin"

	MsgTemplimit string = "templimit1"
)

Watchman

View Source
var (
	MsgContactTimeover string = "✨ Your contact time has expired. ⏳ Please feel free to reach out again when you're ready! 😊"
	MsgContactCancle   string = "❌ You have canceled the contact session. If you need assistance later, don't hesitate to reach out! 😊"
	MsgTempOver               = "MsgTempOver"
)

Contact

View Source
var ErrApierror = errors.New("request not resolverd by server ")
View Source
var ErrBtnClosed = errors.New("user closed btn")
View Source
var ErrChatOrUserNofound = errors.New("chat or user not found")
View Source
var ErrClientRequestFail = errors.New("requests send failed on client side")
View Source
var ErrConfigNotFound = errors.New("config Notfound")
View Source
var ErrContextDead = errors.New("context cancled")
View Source
var ErrDatabaseCreate = errors.New("cannot create record")

Databbase

View Source
var ErrDatabasefuncer = errors.New("database calling error")
View Source
var ErrDbnotfound = errors.New("user cannot find in db")
View Source
var ErrDbopration = errors.New("database opration or transaction failed")
View Source
var ErrInboundNotFound = errors.New("inbound Notfound")
View Source
var ErrJsonopra = errors.New("json marshling error")
View Source
var (
	ErrMsgDisabled = errors.New("msg disabled")
)
View Source
var ErrNilRequest = errors.New("request is nil pointer")
View Source
var ErrNoService = errors.New("No service")
View Source
var ErrNotMsgType = errors.New("type is not valid messagetype")
View Source
var ErrNotsupported = errors.New("type not supporte yet")

Metadata

View Source
var ErrOnDb = errors.New("db tx failed")
View Source
var ErrOnDeactivation = errors.New("deactivation failed")

Usersession

View Source
var ErrOutboundNotFound = errors.New("outbound Notfound")
View Source
var ErrQuotaExceed = errors.New("config quota exceed")
View Source
var ErrRead = errors.New("body reading error")
View Source
var (
	ErrRecurtionExceed = errors.New("recurtion limit hit")
)

Configure command

View Source
var ErrRequest = errors.New("request errored")
View Source
var ErrResponseMissmatch = errors.New("telegram responsed diffrent status code")
View Source
var ErrResultMalformed = errors.New("status result malformed")
View Source
var ErrServiceNotFound = errors.New("service not found")

parser

View Source
var ErrSessioForceClose = errors.New("old session force closing errored ")
View Source
var ErrSessionExcit = errors.New("already session excist")
View Source
var ErrTgParsing = errors.New("parsing error from telegram")
View Source
var (
	ErrTmplRender = errors.New("render template failed")
)

Messagesession

View Source
var ErrTypeMissmatch = errors.New("iobound type not supported or invalid type")
View Source
var ErrUnknownUserListType = errors.New("user list type error")
View Source
var ErrUserCanootReciveUserCapped = errors.New("user cannot recive gifts")

Gift

View Source
var (
	ErrUserExitDb = errors.New("user already in database")
)

refral

View Source
var ErrUserGiftAlready = errors.New("user already recived or send a gift")
View Source
var ErrUserObNil = errors.New("user struct cannot be nil")
View Source
var ErrWebhookSetFailed = errors.New("setting web hook failed")
View Source
var Erruuidcreatefailed = errors.New("uuid create failed")
View Source
var (
	MsgBtnOffline string = "⚠️ It looks like the button is no longer online. Please restart the command 🔌"
)

callbackDefaul

View Source
var (
	MsgGiftSent string = "🎁 You have successfully sent a gift of %v to %v. 🌟 Enjoy sharing the love!"
)
View Source
var (
	Msgxrayuse string = "🔒 You need to be a verified user to use Xray services."
)

Functions

func ExcuteMap

func ExcuteMap[T comparable, Y any](in map[T]Y, excuter func(v Y, key T))

func ExcuteSlice

func ExcuteSlice[T any](in []T, exec func(*T))

func GetFromSlice

func GetFromSlice[T any](in []T, getter func(T) bool) *T

func GetMsg

func GetMsg(inmg string) string

func IsInSlice

func IsInSlice[T any](in []T, check func(T) bool) bool

func LoadUserMsg

func LoadUserMsg() error

func MapPtrToSlicePtr

func MapPtrToSlicePtr[T comparable, Y any](in map[T]*Y) []*Y

func MapToSlice

func MapToSlice[T comparable, Y any](in map[T]Y) []Y

func MapToSliceKey

func MapToSliceKey[T comparable, Y any](in map[T]Y) []T

func MapToSlicePtr

func MapToSlicePtr[T comparable, Y any](in map[T]*Y) []Y

func RemoveItem

func RemoveItem[T any](in []T, docompare func(T) bool) []T

func SliceToMap

func SliceToMap[T comparable, Y any](in []Y, getkey func(Y) T) map[T]Y

func SliceToMapPtr

func SliceToMapPtr[T comparable, Y any](in []Y, getkey func(Y) T) map[T]*Y

Types

type Bwidth

type Bwidth float64

use this for bandwidth represtation

func BwidthString

func BwidthString(bwidth string) (Bwidth, error)

retuns Byte value 2MB => 2 * 1024 * 1024

func ParserBwidth

func ParserBwidth(i string) (Bwidth, error)

return value as bytes, if no suffix found input will prosess as gb

func (Bwidth) BToString

func (b Bwidth) BToString() string

convert byte value to readble

func (Bwidth) BytetoGB

func (b Bwidth) BytetoGB() Bwidth

func (Bwidth) BytetoKB

func (b Bwidth) BytetoKB() Bwidth

func (Bwidth) BytetoMB

func (b Bwidth) BytetoMB() Bwidth

func (Bwidth) Float64

func (b Bwidth) Float64() float64

func (Bwidth) GbtoByte

func (b Bwidth) GbtoByte() Bwidth

func (Bwidth) Int

func (b Bwidth) Int() int

func (Bwidth) Int32

func (b Bwidth) Int32() int32

carefull with this method

func (Bwidth) Int64

func (b Bwidth) Int64() int64

func (Bwidth) KbtoBYte

func (b Bwidth) KbtoBYte() Bwidth

func (Bwidth) MbtoBYte

func (b Bwidth) MbtoBYte() Bwidth

func (Bwidth) String

func (b Bwidth) String() string

type UserMsg

type UserMsg map[string]string
var AllUserMsg UserMsg

Jump to

Keyboard shortcuts

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