Documentation ¶
Index ¶
- Constants
- func GetDefaultConfigPath() (string, error)
- func GetOptionsByNotification(cfg NotificationConfig) msgprocessor.Options
- func GetProjectRoot() (string, error)
- func LoadConfig(path string, envPrefix string, config any) error
- type API
- type AfterConfig
- type Auth
- type BeforeConfig
- type CacheConfig
- type Conversation
- type Cos
- type CronTask
- type Discovery
- type Etcd
- type Friend
- type Group
- type Kafka
- type Kodo
- type LocalCache
- type Log
- type Minio
- type Mongo
- type Msg
- type MsgGateway
- type MsgTransfer
- type MultiLogin
- type Notification
- type NotificationConfig
- type OfflinePushConfig
- type Oss
- type Prometheus
- type Push
- type Redis
- type RpcRegisterName
- type Share
- type TLSConfig
- type Third
- type User
- type Webhooks
- type ZooKeeper
Constants ¶
View Source
const ( // DefaultDirPerm is used for creating general directories, allowing the owner to read, write, and execute, // while the group and others can only read and execute. DefaultDirPerm = 0755 // PrivateFilePerm is used for sensitive files, allowing only the owner to read and write. PrivateFilePerm = 0600 // ExecFilePerm is used for executable files, allowing the owner to read, write, and execute, // while the group and others can only read. ExecFilePerm = 0754 // with no permissions for others. SharedDirPerm = 0770 // ReadOnlyDirPerm is used for read-only directories, allowing the owner, group, and others to only read. ReadOnlyDirPerm = 0555 )
View Source
const ( FileName = "config.yaml" NotificationFileName = "notification.yaml" DefaultFolderPath = "../config/" )
View Source
const ConfKey = "conf"
Variables ¶
This section is empty.
Functions ¶
func GetDefaultConfigPath ¶ added in v3.4.0
return absolude path join ../config/, this is k8s container config path.
func GetOptionsByNotification ¶
func GetOptionsByNotification(cfg NotificationConfig) msgprocessor.Options
func GetProjectRoot ¶ added in v3.4.0
getProjectRoot returns the absolute path of the project root directory.
Types ¶
type API ¶ added in v3.7.0
type API struct { Api struct { ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` CompressionLevel int `mapstructure:"compressionLevel"` } `mapstructure:"api"` Prometheus struct { Enable bool `mapstructure:"enable"` Ports []int `mapstructure:"ports"` GrafanaURL string `mapstructure:"grafanaURL"` } `mapstructure:"prometheus"` }
type AfterConfig ¶ added in v3.7.0
type Auth ¶ added in v3.7.0
type Auth struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` TokenPolicy struct { Expire int64 `mapstructure:"expire"` } `mapstructure:"tokenPolicy"` }
type BeforeConfig ¶ added in v3.7.0
type CacheConfig ¶ added in v3.7.0
type CacheConfig struct { Topic string `mapstructure:"topic"` SlotNum int `mapstructure:"slotNum"` SlotSize int `mapstructure:"slotSize"` SuccessExpire int `mapstructure:"successExpire"` FailedExpire int `mapstructure:"failedExpire"` }
func (*CacheConfig) Enable ¶ added in v3.7.0
func (l *CacheConfig) Enable() bool
func (*CacheConfig) Failed ¶ added in v3.7.0
func (l *CacheConfig) Failed() time.Duration
func (*CacheConfig) Success ¶ added in v3.7.0
func (l *CacheConfig) Success() time.Duration
type Conversation ¶ added in v3.7.0
type Conversation struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` }
type Cos ¶ added in v3.7.0
type Friend ¶ added in v3.7.0
type Friend struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` }
type Group ¶ added in v3.7.0
type Group struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` EnableHistoryForNewMembers bool `mapstructure:"enableHistoryForNewMembers"` }
type Kafka ¶ added in v3.7.0
type Kafka struct { Username string `mapstructure:"username"` Password string `mapstructure:"password"` ProducerAck string `mapstructure:"producerAck"` CompressType string `mapstructure:"compressType"` Address []string `mapstructure:"address"` ToRedisTopic string `mapstructure:"toRedisTopic"` ToMongoTopic string `mapstructure:"toMongoTopic"` ToPushTopic string `mapstructure:"toPushTopic"` ToOfflinePushTopic string `mapstructure:"toOfflinePushTopic"` ToRedisGroupID string `mapstructure:"toRedisGroupID"` ToMongoGroupID string `mapstructure:"toMongoGroupID"` ToPushGroupID string `mapstructure:"toPushGroupID"` ToOfflineGroupID string `mapstructure:"toOfflinePushGroupID"` Tls TLSConfig `mapstructure:"tls"` }
type Kodo ¶ added in v3.8.0
type Kodo struct { Endpoint string `mapstructure:"endpoint"` Bucket string `mapstructure:"bucket"` BucketURL string `mapstructure:"bucketURL"` AccessKeyID string `mapstructure:"accessKeyID"` AccessKeySecret string `mapstructure:"accessKeySecret"` SessionToken string `mapstructure:"sessionToken"` PublicRead bool `mapstructure:"publicRead"` }
type LocalCache ¶ added in v3.7.0
type LocalCache struct { User CacheConfig `mapstructure:"user"` Group CacheConfig `mapstructure:"group"` Friend CacheConfig `mapstructure:"friend"` Conversation CacheConfig `mapstructure:"conversation"` }
type Log ¶ added in v3.7.0
type Log struct { StorageLocation string `mapstructure:"storageLocation"` RotationTime uint `mapstructure:"rotationTime"` RemainRotationCount uint `mapstructure:"remainRotationCount"` RemainLogLevel int `mapstructure:"remainLogLevel"` IsStdout bool `mapstructure:"isStdout"` IsJson bool `mapstructure:"isJson"` IsSimplify bool `mapstructure:"isSimplify"` WithStack bool `mapstructure:"withStack"` }
type Minio ¶ added in v3.7.0
type Minio struct { Bucket string `mapstructure:"bucket"` AccessKeyID string `mapstructure:"accessKeyID"` SecretAccessKey string `mapstructure:"secretAccessKey"` SessionToken string `mapstructure:"sessionToken"` InternalAddress string `mapstructure:"internalAddress"` ExternalAddress string `mapstructure:"externalAddress"` PublicRead bool `mapstructure:"publicRead"` }
type Mongo ¶ added in v3.7.0
type Mongo struct { URI string `mapstructure:"uri"` Address []string `mapstructure:"address"` Database string `mapstructure:"database"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` AuthSource string `mapstructure:"authSource"` MaxPoolSize int `mapstructure:"maxPoolSize"` MaxRetry int `mapstructure:"maxRetry"` }
type Msg ¶ added in v3.7.0
type Msg struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` FriendVerify bool `mapstructure:"friendVerify"` }
type MsgGateway ¶ added in v3.7.0
type MsgGateway struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` ListenIP string `mapstructure:"listenIP"` LongConnSvr struct { Ports []int `mapstructure:"ports"` WebsocketMaxConnNum int `mapstructure:"websocketMaxConnNum"` WebsocketMaxMsgLen int `mapstructure:"websocketMaxMsgLen"` WebsocketTimeout int `mapstructure:"websocketTimeout"` } `mapstructure:"longConnSvr"` }
type MsgTransfer ¶ added in v3.7.0
type MsgTransfer struct {
Prometheus Prometheus `mapstructure:"prometheus"`
}
type MultiLogin ¶ added in v3.8.2
type Notification ¶ added in v3.7.0
type Notification struct { GroupCreated NotificationConfig `mapstructure:"groupCreated"` GroupInfoSet NotificationConfig `mapstructure:"groupInfoSet"` JoinGroupApplication NotificationConfig `mapstructure:"joinGroupApplication"` MemberQuit NotificationConfig `mapstructure:"memberQuit"` GroupApplicationAccepted NotificationConfig `mapstructure:"groupApplicationAccepted"` GroupApplicationRejected NotificationConfig `mapstructure:"groupApplicationRejected"` GroupOwnerTransferred NotificationConfig `mapstructure:"groupOwnerTransferred"` MemberKicked NotificationConfig `mapstructure:"memberKicked"` MemberInvited NotificationConfig `mapstructure:"memberInvited"` MemberEnter NotificationConfig `mapstructure:"memberEnter"` GroupDismissed NotificationConfig `mapstructure:"groupDismissed"` GroupMuted NotificationConfig `mapstructure:"groupMuted"` GroupCancelMuted NotificationConfig `mapstructure:"groupCancelMuted"` GroupMemberMuted NotificationConfig `mapstructure:"groupMemberMuted"` GroupMemberCancelMuted NotificationConfig `mapstructure:"groupMemberCancelMuted"` GroupMemberInfoSet NotificationConfig `mapstructure:"groupMemberInfoSet"` GroupMemberSetToAdmin NotificationConfig `yaml:"groupMemberSetToAdmin"` GroupMemberSetToOrdinary NotificationConfig `yaml:"groupMemberSetToOrdinaryUser"` GroupInfoSetAnnouncement NotificationConfig `mapstructure:"groupInfoSetAnnouncement"` GroupInfoSetName NotificationConfig `mapstructure:"groupInfoSetName"` FriendApplicationAdded NotificationConfig `mapstructure:"friendApplicationAdded"` FriendApplicationApproved NotificationConfig `mapstructure:"friendApplicationApproved"` FriendApplicationRejected NotificationConfig `mapstructure:"friendApplicationRejected"` FriendAdded NotificationConfig `mapstructure:"friendAdded"` FriendDeleted NotificationConfig `mapstructure:"friendDeleted"` FriendRemarkSet NotificationConfig `mapstructure:"friendRemarkSet"` BlackAdded NotificationConfig `mapstructure:"blackAdded"` BlackDeleted NotificationConfig `mapstructure:"blackDeleted"` FriendInfoUpdated NotificationConfig `mapstructure:"friendInfoUpdated"` UserInfoUpdated NotificationConfig `mapstructure:"userInfoUpdated"` UserStatusChanged NotificationConfig `mapstructure:"userStatusChanged"` ConversationChanged NotificationConfig `mapstructure:"conversationChanged"` ConversationSetPrivate NotificationConfig `mapstructure:"conversationSetPrivate"` }
type NotificationConfig ¶ added in v3.7.0
type NotificationConfig struct { IsSendMsg bool `mapstructure:"isSendMsg"` ReliabilityLevel int `mapstructure:"reliabilityLevel"` UnreadCount bool `mapstructure:"unreadCount"` OfflinePush OfflinePushConfig `mapstructure:"offlinePush"` }
type OfflinePushConfig ¶ added in v3.7.0
type Oss ¶ added in v3.7.0
type Oss struct { Endpoint string `mapstructure:"endpoint"` Bucket string `mapstructure:"bucket"` BucketURL string `mapstructure:"bucketURL"` AccessKeyID string `mapstructure:"accessKeyID"` AccessKeySecret string `mapstructure:"accessKeySecret"` SessionToken string `mapstructure:"sessionToken"` PublicRead bool `mapstructure:"publicRead"` }
type Prometheus ¶ added in v3.7.0
type Push ¶ added in v3.7.0
type Push struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` MaxConcurrentWorkers int `mapstructure:"maxConcurrentWorkers"` Enable string `mapstructure:"enable"` GeTui struct { PushUrl string `mapstructure:"pushUrl"` MasterSecret string `mapstructure:"masterSecret"` AppKey string `mapstructure:"appKey"` Intent string `mapstructure:"intent"` ChannelID string `mapstructure:"channelID"` ChannelName string `mapstructure:"channelName"` } `mapstructure:"geTui"` FCM struct { FilePath string `mapstructure:"filePath"` AuthURL string `mapstructure:"authURL"` } `mapstructure:"fcm"` JPush struct { AppKey string `mapstructure:"appKey"` MasterSecret string `mapstructure:"masterSecret"` PushURL string `mapstructure:"pushURL"` PushIntent string `mapstructure:"pushIntent"` } `mapstructure:"jpush"` IOSPush struct { PushSound string `mapstructure:"pushSound"` BadgeCount bool `mapstructure:"badgeCount"` Production bool `mapstructure:"production"` } `mapstructure:"iosPush"` FullUserCache bool `mapstructure:"fullUserCache"` }
type Redis ¶ added in v3.7.0
type Redis struct { Address []string `mapstructure:"address"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` ClusterMode bool `mapstructure:"clusterMode"` DB int `mapstructure:"storage"` MaxRetry int `mapstructure:"maxRetry"` PoolSize int `mapstructure:"poolSize"` }
type RpcRegisterName ¶ added in v3.7.0
type RpcRegisterName struct { User string `mapstructure:"user"` Friend string `mapstructure:"friend"` Msg string `mapstructure:"msg"` Push string `mapstructure:"push"` MessageGateway string `mapstructure:"messageGateway"` Group string `mapstructure:"group"` Auth string `mapstructure:"auth"` Conversation string `mapstructure:"conversation"` Third string `mapstructure:"third"` }
func (*RpcRegisterName) GetServiceNames ¶ added in v3.7.0
func (r *RpcRegisterName) GetServiceNames() []string
type TLSConfig ¶ added in v3.7.0
type TLSConfig struct { EnableTLS bool `mapstructure:"enableTLS"` CACrt string `mapstructure:"caCrt"` ClientCrt string `mapstructure:"clientCrt"` ClientKey string `mapstructure:"clientKey"` ClientKeyPwd string `mapstructure:"clientKeyPwd"` InsecureSkipVerify bool `mapstructure:"insecureSkipVerify"` }
type Third ¶ added in v3.7.0
type Third struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` Object struct { Enable string `mapstructure:"enable"` Cos Cos `mapstructure:"cos"` Oss Oss `mapstructure:"oss"` Kodo Kodo `mapstructure:"kodo"` Aws struct { Endpoint string `mapstructure:"endpoint"` Region string `mapstructure:"region"` Bucket string `mapstructure:"bucket"` AccessKeyID string `mapstructure:"accessKeyID"` AccessKeySecret string `mapstructure:"accessKeySecret"` PublicRead bool `mapstructure:"publicRead"` } `mapstructure:"aws"` } `mapstructure:"object"` }
type User ¶ added in v3.7.0
type User struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` ListenIP string `mapstructure:"listenIP"` Ports []int `mapstructure:"ports"` } `mapstructure:"rpc"` Prometheus Prometheus `mapstructure:"prometheus"` }
type Webhooks ¶ added in v3.7.0
type Webhooks struct { URL string `mapstructure:"url"` BeforeSendSingleMsg BeforeConfig `mapstructure:"beforeSendSingleMsg"` BeforeUpdateUserInfoEx BeforeConfig `mapstructure:"beforeUpdateUserInfoEx"` AfterUpdateUserInfoEx AfterConfig `mapstructure:"afterUpdateUserInfoEx"` AfterSendSingleMsg AfterConfig `mapstructure:"afterSendSingleMsg"` BeforeSendGroupMsg BeforeConfig `mapstructure:"beforeSendGroupMsg"` BeforeMsgModify BeforeConfig `mapstructure:"beforeMsgModify"` AfterSendGroupMsg AfterConfig `mapstructure:"afterSendGroupMsg"` AfterUserOnline AfterConfig `mapstructure:"afterUserOnline"` AfterUserOffline AfterConfig `mapstructure:"afterUserOffline"` AfterUserKickOff AfterConfig `mapstructure:"afterUserKickOff"` BeforeOfflinePush BeforeConfig `mapstructure:"beforeOfflinePush"` BeforeOnlinePush BeforeConfig `mapstructure:"beforeOnlinePush"` BeforeGroupOnlinePush BeforeConfig `mapstructure:"beforeGroupOnlinePush"` BeforeAddFriend BeforeConfig `mapstructure:"beforeAddFriend"` BeforeUpdateUserInfo BeforeConfig `mapstructure:"beforeUpdateUserInfo"` AfterUpdateUserInfo AfterConfig `mapstructure:"afterUpdateUserInfo"` BeforeCreateGroup BeforeConfig `mapstructure:"beforeCreateGroup"` AfterCreateGroup AfterConfig `mapstructure:"afterCreateGroup"` BeforeMemberJoinGroup BeforeConfig `mapstructure:"beforeMemberJoinGroup"` BeforeSetGroupMemberInfo BeforeConfig `mapstructure:"beforeSetGroupMemberInfo"` AfterSetGroupMemberInfo AfterConfig `mapstructure:"afterSetGroupMemberInfo"` AfterQuitGroup AfterConfig `mapstructure:"afterQuitGroup"` AfterKickGroupMember AfterConfig `mapstructure:"afterKickGroupMember"` AfterDismissGroup AfterConfig `mapstructure:"afterDismissGroup"` BeforeApplyJoinGroup BeforeConfig `mapstructure:"beforeApplyJoinGroup"` AfterGroupMsgRead AfterConfig `mapstructure:"afterGroupMsgRead"` AfterSingleMsgRead AfterConfig `mapstructure:"afterSingleMsgRead"` BeforeUserRegister BeforeConfig `mapstructure:"beforeUserRegister"` AfterUserRegister AfterConfig `mapstructure:"afterUserRegister"` AfterTransferGroupOwner AfterConfig `mapstructure:"afterTransferGroupOwner"` BeforeSetFriendRemark BeforeConfig `mapstructure:"beforeSetFriendRemark"` AfterSetFriendRemark AfterConfig `mapstructure:"afterSetFriendRemark"` AfterGroupMsgRevoke AfterConfig `mapstructure:"afterGroupMsgRevoke"` AfterJoinGroup AfterConfig `mapstructure:"afterJoinGroup"` BeforeInviteUserToGroup BeforeConfig `mapstructure:"beforeInviteUserToGroup"` AfterSetGroupInfo AfterConfig `mapstructure:"afterSetGroupInfo"` BeforeSetGroupInfo BeforeConfig `mapstructure:"beforeSetGroupInfo"` AfterSetGroupInfoEx AfterConfig `mapstructure:"afterSetGroupInfoEx"` BeforeSetGroupInfoEx BeforeConfig `mapstructure:"beforeSetGroupInfoEx"` AfterRevokeMsg AfterConfig `mapstructure:"afterRevokeMsg"` BeforeAddBlack BeforeConfig `mapstructure:"beforeAddBlack"` AfterAddFriend AfterConfig `mapstructure:"afterAddFriend"` BeforeAddFriendAgree BeforeConfig `mapstructure:"beforeAddFriendAgree"` AfterAddFriendAgree AfterConfig `mapstructure:"afterAddFriendAgree"` AfterDeleteFriend AfterConfig `mapstructure:"afterDeleteFriend"` BeforeImportFriends BeforeConfig `mapstructure:"beforeImportFriends"` AfterImportFriends AfterConfig `mapstructure:"afterImportFriends"` AfterRemoveBlack AfterConfig `mapstructure:"afterRemoveBlack"` }
FullConfig stores all configurations for before and after events
Click to show internal directories.
Click to hide internal directories.