Documentation ¶
Index ¶
- func CheckPasswordHash(password, hash string) bool
- func ControlSystemService(args []string, action string, run func()) error
- func CreateSystemService(args []string, run func()) (service.Service, error)
- func EncodeBase64(data string) string
- func GetIntValueFromStr(c context.Context, key string) (int, bool)
- func GetJwtToken(secretKey string, iat, seconds int64, payload string) (string, error)
- func GetJwtTokenFromMap(secretKey string, iat, seconds int64, payload map[string]string) (string, error)
- func GetValue[T any](c context.Context, key string) (T, bool)
- func HashPassword(password string) (string, error)
- func InstallToSystemPath(installPath string) error
- func IsClientIDPermited(clientID string) bool
- func IsInteger(str string) bool
- func IsSameDay(first time.Time, second time.Time) bool
- func LoadClientConfig(content []byte, strict bool) (*v1.ClientCommonConfig, []v1.ProxyConfigurer, []v1.VisitorConfigurer, error)
- func LoadClientConfigNormal(content []byte, strict bool) (*v1.ClientConfig, error)
- func LoadConfigureFromContent(content []byte, c any, strict bool) error
- func LoadContentWithTemplate(content []byte, values *config.Values) ([]byte, error)
- func LoadProxiesFromContent(content []byte) ([]v1.TypedProxyConfig, error)
- func LoadServerConfig(content []byte, strict bool) (*v1.ServerConfig, error)
- func LoadVisitorsFromContent(content []byte) ([]v1.TypedVisitorConfig, error)
- func MD5[T []byte | string](input T) string
- func NewBaseFRPClientConfig(serverAddr string, serverPort int, token string) *v1.ClientCommonConfig
- func NewBaseFRPClientUserAuthConfig(serverAddr string, serverPort int, user, token string) *v1.ClientCommonConfig
- func NewBaseFRPServerConfig(port int, token string) *v1.ServerConfig
- func NewBaseFRPServerUserAuthConfig(port int, opts []v1.HTTPPluginOptions) *v1.ServerConfig
- func NewProxyKey(clientID, serverID, proxyName string) string
- func ParseToken(secretKey, tokenStr string) (u jwt.MapClaims, err error)
- func PemBlockForPrivKey(priv interface{}) *pem.Block
- func PublicKey(priv interface{}) interface{}
- func SHA1(input string) string
- func Str2Int64(str string) int64
- func Str2Int64Default(str string, intVal int64) int64
- func TLSClientCert(caPem []byte) (credentials.TransportCredentials, error)
- func TLSClientCertNoValidate(caPem []byte) (credentials.TransportCredentials, error)
- func TLSServerCert(certPem, keyPem []byte) (credentials.TransportCredentials, error)
- func ToStr(any interface{}) string
- func TransformProxyConfigurerToMap(origin v1.ProxyConfigurer) (key string, r v1.ProxyConfigurer)
- func TransformVisitorConfigurerToMap(origin v1.VisitorConfigurer) (key string, r v1.VisitorConfigurer)
- func ValidateJwtToken(secretKey, token string) (bool, error)
- type SyncMap
- func (s *SyncMap[K, V]) Clone() SyncMap[K, V]
- func (s *SyncMap[K, V]) Delete(key K)
- func (s *SyncMap[K, V]) Grow(size int)
- func (s *SyncMap[K, V]) Keys() []K
- func (s *SyncMap[K, V]) Len() (l int)
- func (s *SyncMap[K, V]) Load(key K) (value V, loaded bool)
- func (s *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)
- func (s *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
- func (s *SyncMap[K, V]) Range(f func(key K, value V) (shouldContinue bool))
- func (s *SyncMap[K, V]) Store(key K, value V)
- func (s *SyncMap[K, V]) Values() []V
- type SystemService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func ControlSystemService ¶ added in v0.0.32
func CreateSystemService ¶ added in v0.0.34
func EncodeBase64 ¶ added in v0.0.32
func GetJwtToken ¶
@secretKey: JWT 加解密密钥 @iat: 时间戳 @seconds: 过期时间,单位秒 @payload: 数据载体
func GetJwtTokenFromMap ¶
func GetJwtTokenFromMap(secretKey string, iat, seconds int64, payload map[string]string) (string, error)
@secretKey: JWT 加解密密钥 @iat: 时间戳 @seconds: 过期时间,单位秒 @payload: 数据载体
func HashPassword ¶
func InstallToSystemPath ¶ added in v0.0.32
func IsClientIDPermited ¶ added in v0.1.0
func LoadClientConfig ¶
func LoadClientConfig(content []byte, strict bool) ( *v1.ClientCommonConfig, []v1.ProxyConfigurer, []v1.VisitorConfigurer, error, )
func LoadClientConfigNormal ¶
func LoadClientConfigNormal(content []byte, strict bool) (*v1.ClientConfig, error)
func LoadContentWithTemplate ¶
func LoadProxiesFromContent ¶ added in v0.1.0
func LoadProxiesFromContent(content []byte) ([]v1.TypedProxyConfig, error)
func LoadServerConfig ¶
func LoadServerConfig(content []byte, strict bool) (*v1.ServerConfig, error)
func LoadVisitorsFromContent ¶ added in v0.1.0
func LoadVisitorsFromContent(content []byte) ([]v1.TypedVisitorConfig, error)
func NewBaseFRPClientConfig ¶
func NewBaseFRPClientConfig(serverAddr string, serverPort int, token string) *v1.ClientCommonConfig
func NewBaseFRPClientUserAuthConfig ¶
func NewBaseFRPClientUserAuthConfig(serverAddr string, serverPort int, user, token string) *v1.ClientCommonConfig
func NewBaseFRPServerConfig ¶
func NewBaseFRPServerConfig(port int, token string) *v1.ServerConfig
func NewBaseFRPServerUserAuthConfig ¶
func NewBaseFRPServerUserAuthConfig(port int, opts []v1.HTTPPluginOptions) *v1.ServerConfig
func NewProxyKey ¶ added in v0.1.0
func ParseToken ¶
func PemBlockForPrivKey ¶
func Str2Int64Default ¶
func TLSClientCert ¶
func TLSClientCert(caPem []byte) (credentials.TransportCredentials, error)
func TLSClientCertNoValidate ¶
func TLSClientCertNoValidate(caPem []byte) (credentials.TransportCredentials, error)
func TLSServerCert ¶
func TLSServerCert(certPem, keyPem []byte) (credentials.TransportCredentials, error)
func TransformProxyConfigurerToMap ¶
func TransformProxyConfigurerToMap(origin v1.ProxyConfigurer) (key string, r v1.ProxyConfigurer)
func TransformVisitorConfigurerToMap ¶
func TransformVisitorConfigurerToMap(origin v1.VisitorConfigurer) (key string, r v1.VisitorConfigurer)
func ValidateJwtToken ¶
@secretKey: JWT 加解密密钥 @token: JWT Token 的字符串
Types ¶
type SyncMap ¶ added in v0.0.32
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
SyncMap is like a Go sync.Map but type-safe using generics.
The zero SyncMap is empty and ready for use. A SyncMap must not be copied after first use.
func (*SyncMap[K, V]) Delete ¶ added in v0.0.32
func (s *SyncMap[K, V]) Delete(key K)
Delete deletes the value for a key.
func (*SyncMap[K, V]) Grow ¶ added in v0.0.32
Grow grows the map to the given size. It can be called before the first write operation used.
func (*SyncMap[K, V]) Keys ¶ added in v0.0.32
func (s *SyncMap[K, V]) Keys() []K
Keys return slice with all map keys.
func (*SyncMap[K, V]) Load ¶ added in v0.0.32
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*SyncMap[K, V]) LoadAndDelete ¶ added in v0.0.32
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*SyncMap[K, V]) LoadOrStore ¶ added in v0.0.32
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*SyncMap[K, V]) Range ¶ added in v0.0.32
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once. Range does not block other methods on the receiver; even f itself may call any method on m.