Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
b6d46fd5
Unverified
Commit
b6d46fd5
authored
Mar 27, 2026
by
InCerryGit
Committed by
GitHub
Mar 27, 2026
Browse files
Merge branch 'Wei-Shaw:main' into main
parents
fa68cbad
fdd8499f
Changes
107
Expand all
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
b6d46fd5
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
**AI API Gateway Platform for Subscription Quota Distribution**
**AI API Gateway Platform for Subscription Quota Distribution**
English |
[
中文
](
README_CN.md
)
English |
[
中文
](
README_CN.md
)
|
[
日本語
](
README_JA.md
)
</div>
</div>
...
...
README_CN.md
View file @
b6d46fd5
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
**AI API 网关平台 - 订阅配额分发管理**
**AI API 网关平台 - 订阅配额分发管理**
[
English
](
README.md
)
| 中文
[
English
](
README.md
)
| 中文
|
[
日本語
](
README_JA.md
)
</div>
</div>
...
...
README_JA.md
0 → 100644
View file @
b6d46fd5
This diff is collapsed.
Click to expand it.
backend/cmd/server/VERSION
View file @
b6d46fd5
0.1.10
4
0.1.10
5
backend/cmd/server/wire_gen.go
View file @
b6d46fd5
...
@@ -132,14 +132,17 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
...
@@ -132,14 +132,17 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
antigravityQuotaFetcher
:=
service
.
NewAntigravityQuotaFetcher
(
proxyRepository
)
antigravityQuotaFetcher
:=
service
.
NewAntigravityQuotaFetcher
(
proxyRepository
)
usageCache
:=
service
.
NewUsageCache
()
usageCache
:=
service
.
NewUsageCache
()
identityCache
:=
repository
.
NewIdentityCache
(
redisClient
)
identityCache
:=
repository
.
NewIdentityCache
(
redisClient
)
accountUsageService
:=
service
.
NewAccountUsageService
(
accountRepository
,
usageLogRepository
,
claudeUsageFetcher
,
geminiQuotaService
,
antigravityQuotaFetcher
,
usageCache
,
identityCache
)
geminiTokenProvider
:=
service
.
ProvideGeminiTokenProvider
(
accountRepository
,
geminiTokenCache
,
geminiOAuthService
,
oauthRefreshAPI
)
geminiTokenProvider
:=
service
.
ProvideGeminiTokenProvider
(
accountRepository
,
geminiTokenCache
,
geminiOAuthService
,
oauthRefreshAPI
)
gatewayCache
:=
repository
.
NewGatewayCache
(
redisClient
)
gatewayCache
:=
repository
.
NewGatewayCache
(
redisClient
)
schedulerOutboxRepository
:=
repository
.
NewSchedulerOutboxRepository
(
db
)
schedulerOutboxRepository
:=
repository
.
NewSchedulerOutboxRepository
(
db
)
schedulerSnapshotService
:=
service
.
ProvideSchedulerSnapshotService
(
schedulerCache
,
schedulerOutboxRepository
,
accountRepository
,
groupRepository
,
configConfig
)
schedulerSnapshotService
:=
service
.
ProvideSchedulerSnapshotService
(
schedulerCache
,
schedulerOutboxRepository
,
accountRepository
,
groupRepository
,
configConfig
)
antigravityTokenProvider
:=
service
.
ProvideAntigravityTokenProvider
(
accountRepository
,
geminiTokenCache
,
antigravityOAuthService
,
oauthRefreshAPI
,
tempUnschedCache
)
antigravityTokenProvider
:=
service
.
ProvideAntigravityTokenProvider
(
accountRepository
,
geminiTokenCache
,
antigravityOAuthService
,
oauthRefreshAPI
,
tempUnschedCache
)
antigravityGatewayService
:=
service
.
NewAntigravityGatewayService
(
accountRepository
,
gatewayCache
,
schedulerSnapshotService
,
antigravityTokenProvider
,
rateLimitService
,
httpUpstream
,
settingService
)
antigravityGatewayService
:=
service
.
NewAntigravityGatewayService
(
accountRepository
,
gatewayCache
,
schedulerSnapshotService
,
antigravityTokenProvider
,
rateLimitService
,
httpUpstream
,
settingService
)
accountTestService
:=
service
.
NewAccountTestService
(
accountRepository
,
geminiTokenProvider
,
antigravityGatewayService
,
httpUpstream
,
configConfig
)
tlsFingerprintProfileRepository
:=
repository
.
NewTLSFingerprintProfileRepository
(
client
)
tlsFingerprintProfileCache
:=
repository
.
NewTLSFingerprintProfileCache
(
redisClient
)
tlsFingerprintProfileService
:=
service
.
NewTLSFingerprintProfileService
(
tlsFingerprintProfileRepository
,
tlsFingerprintProfileCache
)
accountUsageService
:=
service
.
NewAccountUsageService
(
accountRepository
,
usageLogRepository
,
claudeUsageFetcher
,
geminiQuotaService
,
antigravityQuotaFetcher
,
usageCache
,
identityCache
,
tlsFingerprintProfileService
)
accountTestService
:=
service
.
NewAccountTestService
(
accountRepository
,
geminiTokenProvider
,
antigravityGatewayService
,
httpUpstream
,
configConfig
,
tlsFingerprintProfileService
)
crsSyncService
:=
service
.
NewCRSSyncService
(
accountRepository
,
proxyRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
configConfig
)
crsSyncService
:=
service
.
NewCRSSyncService
(
accountRepository
,
proxyRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
configConfig
)
sessionLimitCache
:=
repository
.
ProvideSessionLimitCache
(
redisClient
,
configConfig
)
sessionLimitCache
:=
repository
.
ProvideSessionLimitCache
(
redisClient
,
configConfig
)
rpmCache
:=
repository
.
NewRPMCache
(
redisClient
)
rpmCache
:=
repository
.
NewRPMCache
(
redisClient
)
...
@@ -171,7 +174,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
...
@@ -171,7 +174,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
deferredService
:=
service
.
ProvideDeferredService
(
accountRepository
,
timingWheelService
)
deferredService
:=
service
.
ProvideDeferredService
(
accountRepository
,
timingWheelService
)
claudeTokenProvider
:=
service
.
ProvideClaudeTokenProvider
(
accountRepository
,
geminiTokenCache
,
oAuthService
,
oauthRefreshAPI
)
claudeTokenProvider
:=
service
.
ProvideClaudeTokenProvider
(
accountRepository
,
geminiTokenCache
,
oAuthService
,
oauthRefreshAPI
)
digestSessionStore
:=
service
.
NewDigestSessionStore
()
digestSessionStore
:=
service
.
NewDigestSessionStore
()
gatewayService
:=
service
.
NewGatewayService
(
accountRepository
,
groupRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
identityService
,
httpUpstream
,
deferredService
,
claudeTokenProvider
,
sessionLimitCache
,
rpmCache
,
digestSessionStore
,
settingService
)
gatewayService
:=
service
.
NewGatewayService
(
accountRepository
,
groupRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
identityService
,
httpUpstream
,
deferredService
,
claudeTokenProvider
,
sessionLimitCache
,
rpmCache
,
digestSessionStore
,
settingService
,
tlsFingerprintProfileService
)
openAITokenProvider
:=
service
.
ProvideOpenAITokenProvider
(
accountRepository
,
geminiTokenCache
,
openAIOAuthService
,
oauthRefreshAPI
)
openAITokenProvider
:=
service
.
ProvideOpenAITokenProvider
(
accountRepository
,
geminiTokenCache
,
openAIOAuthService
,
oauthRefreshAPI
)
openAIGatewayService
:=
service
.
NewOpenAIGatewayService
(
accountRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
httpUpstream
,
deferredService
,
openAITokenProvider
)
openAIGatewayService
:=
service
.
NewOpenAIGatewayService
(
accountRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
httpUpstream
,
deferredService
,
openAITokenProvider
)
geminiMessagesCompatService
:=
service
.
NewGeminiMessagesCompatService
(
accountRepository
,
groupRepository
,
gatewayCache
,
schedulerSnapshotService
,
geminiTokenProvider
,
rateLimitService
,
httpUpstream
,
antigravityGatewayService
,
configConfig
)
geminiMessagesCompatService
:=
service
.
NewGeminiMessagesCompatService
(
accountRepository
,
groupRepository
,
gatewayCache
,
schedulerSnapshotService
,
geminiTokenProvider
,
rateLimitService
,
httpUpstream
,
antigravityGatewayService
,
configConfig
)
...
@@ -203,12 +206,13 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
...
@@ -203,12 +206,13 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
errorPassthroughCache
:=
repository
.
NewErrorPassthroughCache
(
redisClient
)
errorPassthroughCache
:=
repository
.
NewErrorPassthroughCache
(
redisClient
)
errorPassthroughService
:=
service
.
NewErrorPassthroughService
(
errorPassthroughRepository
,
errorPassthroughCache
)
errorPassthroughService
:=
service
.
NewErrorPassthroughService
(
errorPassthroughRepository
,
errorPassthroughCache
)
errorPassthroughHandler
:=
admin
.
NewErrorPassthroughHandler
(
errorPassthroughService
)
errorPassthroughHandler
:=
admin
.
NewErrorPassthroughHandler
(
errorPassthroughService
)
tlsFingerprintProfileHandler
:=
admin
.
NewTLSFingerprintProfileHandler
(
tlsFingerprintProfileService
)
adminAPIKeyHandler
:=
admin
.
NewAdminAPIKeyHandler
(
adminService
)
adminAPIKeyHandler
:=
admin
.
NewAdminAPIKeyHandler
(
adminService
)
scheduledTestPlanRepository
:=
repository
.
NewScheduledTestPlanRepository
(
db
)
scheduledTestPlanRepository
:=
repository
.
NewScheduledTestPlanRepository
(
db
)
scheduledTestResultRepository
:=
repository
.
NewScheduledTestResultRepository
(
db
)
scheduledTestResultRepository
:=
repository
.
NewScheduledTestResultRepository
(
db
)
scheduledTestService
:=
service
.
ProvideScheduledTestService
(
scheduledTestPlanRepository
,
scheduledTestResultRepository
)
scheduledTestService
:=
service
.
ProvideScheduledTestService
(
scheduledTestPlanRepository
,
scheduledTestResultRepository
)
scheduledTestHandler
:=
admin
.
NewScheduledTestHandler
(
scheduledTestService
)
scheduledTestHandler
:=
admin
.
NewScheduledTestHandler
(
scheduledTestService
)
adminHandlers
:=
handler
.
ProvideAdminHandlers
(
dashboardHandler
,
adminUserHandler
,
groupHandler
,
accountHandler
,
adminAnnouncementHandler
,
dataManagementHandler
,
backupHandler
,
oAuthHandler
,
openAIOAuthHandler
,
geminiOAuthHandler
,
antigravityOAuthHandler
,
proxyHandler
,
adminRedeemHandler
,
promoHandler
,
settingHandler
,
opsHandler
,
systemHandler
,
adminSubscriptionHandler
,
adminUsageHandler
,
userAttributeHandler
,
errorPassthroughHandler
,
adminAPIKeyHandler
,
scheduledTestHandler
)
adminHandlers
:=
handler
.
ProvideAdminHandlers
(
dashboardHandler
,
adminUserHandler
,
groupHandler
,
accountHandler
,
adminAnnouncementHandler
,
dataManagementHandler
,
backupHandler
,
oAuthHandler
,
openAIOAuthHandler
,
geminiOAuthHandler
,
antigravityOAuthHandler
,
proxyHandler
,
adminRedeemHandler
,
promoHandler
,
settingHandler
,
opsHandler
,
systemHandler
,
adminSubscriptionHandler
,
adminUsageHandler
,
userAttributeHandler
,
errorPassthroughHandler
,
tlsFingerprintProfileHandler
,
adminAPIKeyHandler
,
scheduledTestHandler
)
usageRecordWorkerPool
:=
service
.
NewUsageRecordWorkerPool
(
configConfig
)
usageRecordWorkerPool
:=
service
.
NewUsageRecordWorkerPool
(
configConfig
)
userMsgQueueCache
:=
repository
.
NewUserMsgQueueCache
(
redisClient
)
userMsgQueueCache
:=
repository
.
NewUserMsgQueueCache
(
redisClient
)
userMessageQueueService
:=
service
.
ProvideUserMessageQueueService
(
userMsgQueueCache
,
rpmCache
,
configConfig
)
userMessageQueueService
:=
service
.
ProvideUserMessageQueueService
(
userMsgQueueCache
,
rpmCache
,
configConfig
)
...
...
backend/ent/client.go
View file @
b6d46fd5
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/user"
"github.com/Wei-Shaw/sub2api/ent/user"
...
@@ -73,6 +74,8 @@ type Client struct {
...
@@ -73,6 +74,8 @@ type Client struct {
SecuritySecret
*
SecuritySecretClient
SecuritySecret
*
SecuritySecretClient
// Setting is the client for interacting with the Setting builders.
// Setting is the client for interacting with the Setting builders.
Setting
*
SettingClient
Setting
*
SettingClient
// TLSFingerprintProfile is the client for interacting with the TLSFingerprintProfile builders.
TLSFingerprintProfile
*
TLSFingerprintProfileClient
// UsageCleanupTask is the client for interacting with the UsageCleanupTask builders.
// UsageCleanupTask is the client for interacting with the UsageCleanupTask builders.
UsageCleanupTask
*
UsageCleanupTaskClient
UsageCleanupTask
*
UsageCleanupTaskClient
// UsageLog is the client for interacting with the UsageLog builders.
// UsageLog is the client for interacting with the UsageLog builders.
...
@@ -112,6 +115,7 @@ func (c *Client) init() {
...
@@ -112,6 +115,7 @@ func (c *Client) init() {
c
.
RedeemCode
=
NewRedeemCodeClient
(
c
.
config
)
c
.
RedeemCode
=
NewRedeemCodeClient
(
c
.
config
)
c
.
SecuritySecret
=
NewSecuritySecretClient
(
c
.
config
)
c
.
SecuritySecret
=
NewSecuritySecretClient
(
c
.
config
)
c
.
Setting
=
NewSettingClient
(
c
.
config
)
c
.
Setting
=
NewSettingClient
(
c
.
config
)
c
.
TLSFingerprintProfile
=
NewTLSFingerprintProfileClient
(
c
.
config
)
c
.
UsageCleanupTask
=
NewUsageCleanupTaskClient
(
c
.
config
)
c
.
UsageCleanupTask
=
NewUsageCleanupTaskClient
(
c
.
config
)
c
.
UsageLog
=
NewUsageLogClient
(
c
.
config
)
c
.
UsageLog
=
NewUsageLogClient
(
c
.
config
)
c
.
User
=
NewUserClient
(
c
.
config
)
c
.
User
=
NewUserClient
(
c
.
config
)
...
@@ -225,6 +229,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
...
@@ -225,6 +229,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
RedeemCode
:
NewRedeemCodeClient
(
cfg
),
RedeemCode
:
NewRedeemCodeClient
(
cfg
),
SecuritySecret
:
NewSecuritySecretClient
(
cfg
),
SecuritySecret
:
NewSecuritySecretClient
(
cfg
),
Setting
:
NewSettingClient
(
cfg
),
Setting
:
NewSettingClient
(
cfg
),
TLSFingerprintProfile
:
NewTLSFingerprintProfileClient
(
cfg
),
UsageCleanupTask
:
NewUsageCleanupTaskClient
(
cfg
),
UsageCleanupTask
:
NewUsageCleanupTaskClient
(
cfg
),
UsageLog
:
NewUsageLogClient
(
cfg
),
UsageLog
:
NewUsageLogClient
(
cfg
),
User
:
NewUserClient
(
cfg
),
User
:
NewUserClient
(
cfg
),
...
@@ -265,6 +270,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
...
@@ -265,6 +270,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
RedeemCode
:
NewRedeemCodeClient
(
cfg
),
RedeemCode
:
NewRedeemCodeClient
(
cfg
),
SecuritySecret
:
NewSecuritySecretClient
(
cfg
),
SecuritySecret
:
NewSecuritySecretClient
(
cfg
),
Setting
:
NewSettingClient
(
cfg
),
Setting
:
NewSettingClient
(
cfg
),
TLSFingerprintProfile
:
NewTLSFingerprintProfileClient
(
cfg
),
UsageCleanupTask
:
NewUsageCleanupTaskClient
(
cfg
),
UsageCleanupTask
:
NewUsageCleanupTaskClient
(
cfg
),
UsageLog
:
NewUsageLogClient
(
cfg
),
UsageLog
:
NewUsageLogClient
(
cfg
),
User
:
NewUserClient
(
cfg
),
User
:
NewUserClient
(
cfg
),
...
@@ -304,8 +310,9 @@ func (c *Client) Use(hooks ...Hook) {
...
@@ -304,8 +310,9 @@ func (c *Client) Use(hooks ...Hook) {
c
.
APIKey
,
c
.
Account
,
c
.
AccountGroup
,
c
.
Announcement
,
c
.
AnnouncementRead
,
c
.
APIKey
,
c
.
Account
,
c
.
AccountGroup
,
c
.
Announcement
,
c
.
AnnouncementRead
,
c
.
ErrorPassthroughRule
,
c
.
Group
,
c
.
IdempotencyRecord
,
c
.
PromoCode
,
c
.
ErrorPassthroughRule
,
c
.
Group
,
c
.
IdempotencyRecord
,
c
.
PromoCode
,
c
.
PromoCodeUsage
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
PromoCodeUsage
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAllowedGroup
,
c
.
TLSFingerprintProfile
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
UserSubscription
,
c
.
UserAllowedGroup
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
UserSubscription
,
}
{
}
{
n
.
Use
(
hooks
...
)
n
.
Use
(
hooks
...
)
}
}
...
@@ -318,8 +325,9 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
...
@@ -318,8 +325,9 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
c
.
APIKey
,
c
.
Account
,
c
.
AccountGroup
,
c
.
Announcement
,
c
.
AnnouncementRead
,
c
.
APIKey
,
c
.
Account
,
c
.
AccountGroup
,
c
.
Announcement
,
c
.
AnnouncementRead
,
c
.
ErrorPassthroughRule
,
c
.
Group
,
c
.
IdempotencyRecord
,
c
.
PromoCode
,
c
.
ErrorPassthroughRule
,
c
.
Group
,
c
.
IdempotencyRecord
,
c
.
PromoCode
,
c
.
PromoCodeUsage
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
PromoCodeUsage
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAllowedGroup
,
c
.
TLSFingerprintProfile
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
UserSubscription
,
c
.
UserAllowedGroup
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
UserSubscription
,
}
{
}
{
n
.
Intercept
(
interceptors
...
)
n
.
Intercept
(
interceptors
...
)
}
}
...
@@ -356,6 +364,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
...
@@ -356,6 +364,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
return
c
.
SecuritySecret
.
mutate
(
ctx
,
m
)
return
c
.
SecuritySecret
.
mutate
(
ctx
,
m
)
case
*
SettingMutation
:
case
*
SettingMutation
:
return
c
.
Setting
.
mutate
(
ctx
,
m
)
return
c
.
Setting
.
mutate
(
ctx
,
m
)
case
*
TLSFingerprintProfileMutation
:
return
c
.
TLSFingerprintProfile
.
mutate
(
ctx
,
m
)
case
*
UsageCleanupTaskMutation
:
case
*
UsageCleanupTaskMutation
:
return
c
.
UsageCleanupTask
.
mutate
(
ctx
,
m
)
return
c
.
UsageCleanupTask
.
mutate
(
ctx
,
m
)
case
*
UsageLogMutation
:
case
*
UsageLogMutation
:
...
@@ -2612,6 +2622,139 @@ func (c *SettingClient) mutate(ctx context.Context, m *SettingMutation) (Value,
...
@@ -2612,6 +2622,139 @@ func (c *SettingClient) mutate(ctx context.Context, m *SettingMutation) (Value,
}
}
}
}
// TLSFingerprintProfileClient is a client for the TLSFingerprintProfile schema.
type
TLSFingerprintProfileClient
struct
{
config
}
// NewTLSFingerprintProfileClient returns a client for the TLSFingerprintProfile from the given config.
func
NewTLSFingerprintProfileClient
(
c
config
)
*
TLSFingerprintProfileClient
{
return
&
TLSFingerprintProfileClient
{
config
:
c
}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `tlsfingerprintprofile.Hooks(f(g(h())))`.
func
(
c
*
TLSFingerprintProfileClient
)
Use
(
hooks
...
Hook
)
{
c
.
hooks
.
TLSFingerprintProfile
=
append
(
c
.
hooks
.
TLSFingerprintProfile
,
hooks
...
)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `tlsfingerprintprofile.Intercept(f(g(h())))`.
func
(
c
*
TLSFingerprintProfileClient
)
Intercept
(
interceptors
...
Interceptor
)
{
c
.
inters
.
TLSFingerprintProfile
=
append
(
c
.
inters
.
TLSFingerprintProfile
,
interceptors
...
)
}
// Create returns a builder for creating a TLSFingerprintProfile entity.
func
(
c
*
TLSFingerprintProfileClient
)
Create
()
*
TLSFingerprintProfileCreate
{
mutation
:=
newTLSFingerprintProfileMutation
(
c
.
config
,
OpCreate
)
return
&
TLSFingerprintProfileCreate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// CreateBulk returns a builder for creating a bulk of TLSFingerprintProfile entities.
func
(
c
*
TLSFingerprintProfileClient
)
CreateBulk
(
builders
...*
TLSFingerprintProfileCreate
)
*
TLSFingerprintProfileCreateBulk
{
return
&
TLSFingerprintProfileCreateBulk
{
config
:
c
.
config
,
builders
:
builders
}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func
(
c
*
TLSFingerprintProfileClient
)
MapCreateBulk
(
slice
any
,
setFunc
func
(
*
TLSFingerprintProfileCreate
,
int
))
*
TLSFingerprintProfileCreateBulk
{
rv
:=
reflect
.
ValueOf
(
slice
)
if
rv
.
Kind
()
!=
reflect
.
Slice
{
return
&
TLSFingerprintProfileCreateBulk
{
err
:
fmt
.
Errorf
(
"calling to TLSFingerprintProfileClient.MapCreateBulk with wrong type %T, need slice"
,
slice
)}
}
builders
:=
make
([]
*
TLSFingerprintProfileCreate
,
rv
.
Len
())
for
i
:=
0
;
i
<
rv
.
Len
();
i
++
{
builders
[
i
]
=
c
.
Create
()
setFunc
(
builders
[
i
],
i
)
}
return
&
TLSFingerprintProfileCreateBulk
{
config
:
c
.
config
,
builders
:
builders
}
}
// Update returns an update builder for TLSFingerprintProfile.
func
(
c
*
TLSFingerprintProfileClient
)
Update
()
*
TLSFingerprintProfileUpdate
{
mutation
:=
newTLSFingerprintProfileMutation
(
c
.
config
,
OpUpdate
)
return
&
TLSFingerprintProfileUpdate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// UpdateOne returns an update builder for the given entity.
func
(
c
*
TLSFingerprintProfileClient
)
UpdateOne
(
_m
*
TLSFingerprintProfile
)
*
TLSFingerprintProfileUpdateOne
{
mutation
:=
newTLSFingerprintProfileMutation
(
c
.
config
,
OpUpdateOne
,
withTLSFingerprintProfile
(
_m
))
return
&
TLSFingerprintProfileUpdateOne
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// UpdateOneID returns an update builder for the given id.
func
(
c
*
TLSFingerprintProfileClient
)
UpdateOneID
(
id
int64
)
*
TLSFingerprintProfileUpdateOne
{
mutation
:=
newTLSFingerprintProfileMutation
(
c
.
config
,
OpUpdateOne
,
withTLSFingerprintProfileID
(
id
))
return
&
TLSFingerprintProfileUpdateOne
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// Delete returns a delete builder for TLSFingerprintProfile.
func
(
c
*
TLSFingerprintProfileClient
)
Delete
()
*
TLSFingerprintProfileDelete
{
mutation
:=
newTLSFingerprintProfileMutation
(
c
.
config
,
OpDelete
)
return
&
TLSFingerprintProfileDelete
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// DeleteOne returns a builder for deleting the given entity.
func
(
c
*
TLSFingerprintProfileClient
)
DeleteOne
(
_m
*
TLSFingerprintProfile
)
*
TLSFingerprintProfileDeleteOne
{
return
c
.
DeleteOneID
(
_m
.
ID
)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func
(
c
*
TLSFingerprintProfileClient
)
DeleteOneID
(
id
int64
)
*
TLSFingerprintProfileDeleteOne
{
builder
:=
c
.
Delete
()
.
Where
(
tlsfingerprintprofile
.
ID
(
id
))
builder
.
mutation
.
id
=
&
id
builder
.
mutation
.
op
=
OpDeleteOne
return
&
TLSFingerprintProfileDeleteOne
{
builder
}
}
// Query returns a query builder for TLSFingerprintProfile.
func
(
c
*
TLSFingerprintProfileClient
)
Query
()
*
TLSFingerprintProfileQuery
{
return
&
TLSFingerprintProfileQuery
{
config
:
c
.
config
,
ctx
:
&
QueryContext
{
Type
:
TypeTLSFingerprintProfile
},
inters
:
c
.
Interceptors
(),
}
}
// Get returns a TLSFingerprintProfile entity by its id.
func
(
c
*
TLSFingerprintProfileClient
)
Get
(
ctx
context
.
Context
,
id
int64
)
(
*
TLSFingerprintProfile
,
error
)
{
return
c
.
Query
()
.
Where
(
tlsfingerprintprofile
.
ID
(
id
))
.
Only
(
ctx
)
}
// GetX is like Get, but panics if an error occurs.
func
(
c
*
TLSFingerprintProfileClient
)
GetX
(
ctx
context
.
Context
,
id
int64
)
*
TLSFingerprintProfile
{
obj
,
err
:=
c
.
Get
(
ctx
,
id
)
if
err
!=
nil
{
panic
(
err
)
}
return
obj
}
// Hooks returns the client hooks.
func
(
c
*
TLSFingerprintProfileClient
)
Hooks
()
[]
Hook
{
return
c
.
hooks
.
TLSFingerprintProfile
}
// Interceptors returns the client interceptors.
func
(
c
*
TLSFingerprintProfileClient
)
Interceptors
()
[]
Interceptor
{
return
c
.
inters
.
TLSFingerprintProfile
}
func
(
c
*
TLSFingerprintProfileClient
)
mutate
(
ctx
context
.
Context
,
m
*
TLSFingerprintProfileMutation
)
(
Value
,
error
)
{
switch
m
.
Op
()
{
case
OpCreate
:
return
(
&
TLSFingerprintProfileCreate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Save
(
ctx
)
case
OpUpdate
:
return
(
&
TLSFingerprintProfileUpdate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Save
(
ctx
)
case
OpUpdateOne
:
return
(
&
TLSFingerprintProfileUpdateOne
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Save
(
ctx
)
case
OpDelete
,
OpDeleteOne
:
return
(
&
TLSFingerprintProfileDelete
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Exec
(
ctx
)
default
:
return
nil
,
fmt
.
Errorf
(
"ent: unknown TLSFingerprintProfile mutation op: %q"
,
m
.
Op
())
}
}
// UsageCleanupTaskClient is a client for the UsageCleanupTask schema.
// UsageCleanupTaskClient is a client for the UsageCleanupTask schema.
type
UsageCleanupTaskClient
struct
{
type
UsageCleanupTaskClient
struct
{
config
config
...
@@ -3889,16 +4032,16 @@ type (
...
@@ -3889,16 +4032,16 @@ type (
hooks
struct
{
hooks
struct
{
APIKey
,
Account
,
AccountGroup
,
Announcement
,
AnnouncementRead
,
APIKey
,
Account
,
AccountGroup
,
Announcement
,
AnnouncementRead
,
ErrorPassthroughRule
,
Group
,
IdempotencyRecord
,
PromoCode
,
PromoCodeUsage
,
ErrorPassthroughRule
,
Group
,
IdempotencyRecord
,
PromoCode
,
PromoCodeUsage
,
Proxy
,
RedeemCode
,
SecuritySecret
,
Setting
,
UsageCleanupTask
,
UsageLog
,
User
,
Proxy
,
RedeemCode
,
SecuritySecret
,
Setting
,
TLSFingerprintProfile
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserAttributeValue
,
UsageCleanupTask
,
UsageLog
,
User
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserSubscription
[]
ent
.
Hook
UserAttributeValue
,
UserSubscription
[]
ent
.
Hook
}
}
inters
struct
{
inters
struct
{
APIKey
,
Account
,
AccountGroup
,
Announcement
,
AnnouncementRead
,
APIKey
,
Account
,
AccountGroup
,
Announcement
,
AnnouncementRead
,
ErrorPassthroughRule
,
Group
,
IdempotencyRecord
,
PromoCode
,
PromoCodeUsage
,
ErrorPassthroughRule
,
Group
,
IdempotencyRecord
,
PromoCode
,
PromoCodeUsage
,
Proxy
,
RedeemCode
,
SecuritySecret
,
Setting
,
UsageCleanupTask
,
UsageLog
,
User
,
Proxy
,
RedeemCode
,
SecuritySecret
,
Setting
,
TLSFingerprintProfile
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserAttributeValue
,
UsageCleanupTask
,
UsageLog
,
User
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserSubscription
[]
ent
.
Interceptor
UserAttributeValue
,
UserSubscription
[]
ent
.
Interceptor
}
}
)
)
...
...
backend/ent/ent.go
View file @
b6d46fd5
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/user"
"github.com/Wei-Shaw/sub2api/ent/user"
...
@@ -107,6 +108,7 @@ func checkColumn(t, c string) error {
...
@@ -107,6 +108,7 @@ func checkColumn(t, c string) error {
redeemcode
.
Table
:
redeemcode
.
ValidColumn
,
redeemcode
.
Table
:
redeemcode
.
ValidColumn
,
securitysecret
.
Table
:
securitysecret
.
ValidColumn
,
securitysecret
.
Table
:
securitysecret
.
ValidColumn
,
setting
.
Table
:
setting
.
ValidColumn
,
setting
.
Table
:
setting
.
ValidColumn
,
tlsfingerprintprofile
.
Table
:
tlsfingerprintprofile
.
ValidColumn
,
usagecleanuptask
.
Table
:
usagecleanuptask
.
ValidColumn
,
usagecleanuptask
.
Table
:
usagecleanuptask
.
ValidColumn
,
usagelog
.
Table
:
usagelog
.
ValidColumn
,
usagelog
.
Table
:
usagelog
.
ValidColumn
,
user
.
Table
:
user
.
ValidColumn
,
user
.
Table
:
user
.
ValidColumn
,
...
...
backend/ent/hook/hook.go
View file @
b6d46fd5
...
@@ -177,6 +177,18 @@ func (f SettingFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, err
...
@@ -177,6 +177,18 @@ func (f SettingFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, err
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T. expect *ent.SettingMutation"
,
m
)
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T. expect *ent.SettingMutation"
,
m
)
}
}
// The TLSFingerprintProfileFunc type is an adapter to allow the use of ordinary
// function as TLSFingerprintProfile mutator.
type
TLSFingerprintProfileFunc
func
(
context
.
Context
,
*
ent
.
TLSFingerprintProfileMutation
)
(
ent
.
Value
,
error
)
// Mutate calls f(ctx, m).
func
(
f
TLSFingerprintProfileFunc
)
Mutate
(
ctx
context
.
Context
,
m
ent
.
Mutation
)
(
ent
.
Value
,
error
)
{
if
mv
,
ok
:=
m
.
(
*
ent
.
TLSFingerprintProfileMutation
);
ok
{
return
f
(
ctx
,
mv
)
}
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T. expect *ent.TLSFingerprintProfileMutation"
,
m
)
}
// The UsageCleanupTaskFunc type is an adapter to allow the use of ordinary
// The UsageCleanupTaskFunc type is an adapter to allow the use of ordinary
// function as UsageCleanupTask mutator.
// function as UsageCleanupTask mutator.
type
UsageCleanupTaskFunc
func
(
context
.
Context
,
*
ent
.
UsageCleanupTaskMutation
)
(
ent
.
Value
,
error
)
type
UsageCleanupTaskFunc
func
(
context
.
Context
,
*
ent
.
UsageCleanupTaskMutation
)
(
ent
.
Value
,
error
)
...
...
backend/ent/intercept/intercept.go
View file @
b6d46fd5
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/user"
"github.com/Wei-Shaw/sub2api/ent/user"
...
@@ -466,6 +467,33 @@ func (f TraverseSetting) Traverse(ctx context.Context, q ent.Query) error {
...
@@ -466,6 +467,33 @@ func (f TraverseSetting) Traverse(ctx context.Context, q ent.Query) error {
return
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.SettingQuery"
,
q
)
return
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.SettingQuery"
,
q
)
}
}
// The TLSFingerprintProfileFunc type is an adapter to allow the use of ordinary function as a Querier.
type
TLSFingerprintProfileFunc
func
(
context
.
Context
,
*
ent
.
TLSFingerprintProfileQuery
)
(
ent
.
Value
,
error
)
// Query calls f(ctx, q).
func
(
f
TLSFingerprintProfileFunc
)
Query
(
ctx
context
.
Context
,
q
ent
.
Query
)
(
ent
.
Value
,
error
)
{
if
q
,
ok
:=
q
.
(
*
ent
.
TLSFingerprintProfileQuery
);
ok
{
return
f
(
ctx
,
q
)
}
return
nil
,
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.TLSFingerprintProfileQuery"
,
q
)
}
// The TraverseTLSFingerprintProfile type is an adapter to allow the use of ordinary function as Traverser.
type
TraverseTLSFingerprintProfile
func
(
context
.
Context
,
*
ent
.
TLSFingerprintProfileQuery
)
error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func
(
f
TraverseTLSFingerprintProfile
)
Intercept
(
next
ent
.
Querier
)
ent
.
Querier
{
return
next
}
// Traverse calls f(ctx, q).
func
(
f
TraverseTLSFingerprintProfile
)
Traverse
(
ctx
context
.
Context
,
q
ent
.
Query
)
error
{
if
q
,
ok
:=
q
.
(
*
ent
.
TLSFingerprintProfileQuery
);
ok
{
return
f
(
ctx
,
q
)
}
return
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.TLSFingerprintProfileQuery"
,
q
)
}
// The UsageCleanupTaskFunc type is an adapter to allow the use of ordinary function as a Querier.
// The UsageCleanupTaskFunc type is an adapter to allow the use of ordinary function as a Querier.
type
UsageCleanupTaskFunc
func
(
context
.
Context
,
*
ent
.
UsageCleanupTaskQuery
)
(
ent
.
Value
,
error
)
type
UsageCleanupTaskFunc
func
(
context
.
Context
,
*
ent
.
UsageCleanupTaskQuery
)
(
ent
.
Value
,
error
)
...
@@ -686,6 +714,8 @@ func NewQuery(q ent.Query) (Query, error) {
...
@@ -686,6 +714,8 @@ func NewQuery(q ent.Query) (Query, error) {
return
&
query
[
*
ent
.
SecuritySecretQuery
,
predicate
.
SecuritySecret
,
securitysecret
.
OrderOption
]{
typ
:
ent
.
TypeSecuritySecret
,
tq
:
q
},
nil
return
&
query
[
*
ent
.
SecuritySecretQuery
,
predicate
.
SecuritySecret
,
securitysecret
.
OrderOption
]{
typ
:
ent
.
TypeSecuritySecret
,
tq
:
q
},
nil
case
*
ent
.
SettingQuery
:
case
*
ent
.
SettingQuery
:
return
&
query
[
*
ent
.
SettingQuery
,
predicate
.
Setting
,
setting
.
OrderOption
]{
typ
:
ent
.
TypeSetting
,
tq
:
q
},
nil
return
&
query
[
*
ent
.
SettingQuery
,
predicate
.
Setting
,
setting
.
OrderOption
]{
typ
:
ent
.
TypeSetting
,
tq
:
q
},
nil
case
*
ent
.
TLSFingerprintProfileQuery
:
return
&
query
[
*
ent
.
TLSFingerprintProfileQuery
,
predicate
.
TLSFingerprintProfile
,
tlsfingerprintprofile
.
OrderOption
]{
typ
:
ent
.
TypeTLSFingerprintProfile
,
tq
:
q
},
nil
case
*
ent
.
UsageCleanupTaskQuery
:
case
*
ent
.
UsageCleanupTaskQuery
:
return
&
query
[
*
ent
.
UsageCleanupTaskQuery
,
predicate
.
UsageCleanupTask
,
usagecleanuptask
.
OrderOption
]{
typ
:
ent
.
TypeUsageCleanupTask
,
tq
:
q
},
nil
return
&
query
[
*
ent
.
UsageCleanupTaskQuery
,
predicate
.
UsageCleanupTask
,
usagecleanuptask
.
OrderOption
]{
typ
:
ent
.
TypeUsageCleanupTask
,
tq
:
q
},
nil
case
*
ent
.
UsageLogQuery
:
case
*
ent
.
UsageLogQuery
:
...
...
backend/ent/migrate/schema.go
View file @
b6d46fd5
...
@@ -673,6 +673,30 @@ var (
...
@@ -673,6 +673,30 @@ var (
Columns
:
SettingsColumns
,
Columns
:
SettingsColumns
,
PrimaryKey
:
[]
*
schema
.
Column
{
SettingsColumns
[
0
]},
PrimaryKey
:
[]
*
schema
.
Column
{
SettingsColumns
[
0
]},
}
}
// TLSFingerprintProfilesColumns holds the columns for the "tls_fingerprint_profiles" table.
TLSFingerprintProfilesColumns
=
[]
*
schema
.
Column
{
{
Name
:
"id"
,
Type
:
field
.
TypeInt64
,
Increment
:
true
},
{
Name
:
"created_at"
,
Type
:
field
.
TypeTime
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"timestamptz"
}},
{
Name
:
"updated_at"
,
Type
:
field
.
TypeTime
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"timestamptz"
}},
{
Name
:
"name"
,
Type
:
field
.
TypeString
,
Unique
:
true
,
Size
:
100
},
{
Name
:
"description"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
2147483647
},
{
Name
:
"enable_grease"
,
Type
:
field
.
TypeBool
,
Default
:
false
},
{
Name
:
"cipher_suites"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"curves"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"point_formats"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"signature_algorithms"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"alpn_protocols"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"supported_versions"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"key_share_groups"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"psk_modes"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
{
Name
:
"extensions"
,
Type
:
field
.
TypeJSON
,
Nullable
:
true
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"jsonb"
}},
}
// TLSFingerprintProfilesTable holds the schema information for the "tls_fingerprint_profiles" table.
TLSFingerprintProfilesTable
=
&
schema
.
Table
{
Name
:
"tls_fingerprint_profiles"
,
Columns
:
TLSFingerprintProfilesColumns
,
PrimaryKey
:
[]
*
schema
.
Column
{
TLSFingerprintProfilesColumns
[
0
]},
}
// UsageCleanupTasksColumns holds the columns for the "usage_cleanup_tasks" table.
// UsageCleanupTasksColumns holds the columns for the "usage_cleanup_tasks" table.
UsageCleanupTasksColumns
=
[]
*
schema
.
Column
{
UsageCleanupTasksColumns
=
[]
*
schema
.
Column
{
{
Name
:
"id"
,
Type
:
field
.
TypeInt64
,
Increment
:
true
},
{
Name
:
"id"
,
Type
:
field
.
TypeInt64
,
Increment
:
true
},
...
@@ -1111,6 +1135,7 @@ var (
...
@@ -1111,6 +1135,7 @@ var (
RedeemCodesTable
,
RedeemCodesTable
,
SecuritySecretsTable
,
SecuritySecretsTable
,
SettingsTable
,
SettingsTable
,
TLSFingerprintProfilesTable
,
UsageCleanupTasksTable
,
UsageCleanupTasksTable
,
UsageLogsTable
,
UsageLogsTable
,
UsersTable
,
UsersTable
,
...
@@ -1175,6 +1200,9 @@ func init() {
...
@@ -1175,6 +1200,9 @@ func init() {
SettingsTable
.
Annotation
=
&
entsql
.
Annotation
{
SettingsTable
.
Annotation
=
&
entsql
.
Annotation
{
Table
:
"settings"
,
Table
:
"settings"
,
}
}
TLSFingerprintProfilesTable
.
Annotation
=
&
entsql
.
Annotation
{
Table
:
"tls_fingerprint_profiles"
,
}
UsageCleanupTasksTable
.
Annotation
=
&
entsql
.
Annotation
{
UsageCleanupTasksTable
.
Annotation
=
&
entsql
.
Annotation
{
Table
:
"usage_cleanup_tasks"
,
Table
:
"usage_cleanup_tasks"
,
}
}
...
...
backend/ent/mutation.go
View file @
b6d46fd5
This diff is collapsed.
Click to expand it.
backend/ent/predicate/predicate.go
View file @
b6d46fd5
...
@@ -48,6 +48,9 @@ type SecuritySecret func(*sql.Selector)
...
@@ -48,6 +48,9 @@ type SecuritySecret func(*sql.Selector)
// Setting is the predicate function for setting builders.
// Setting is the predicate function for setting builders.
type
Setting
func
(
*
sql
.
Selector
)
type
Setting
func
(
*
sql
.
Selector
)
// TLSFingerprintProfile is the predicate function for tlsfingerprintprofile builders.
type
TLSFingerprintProfile
func
(
*
sql
.
Selector
)
// UsageCleanupTask is the predicate function for usagecleanuptask builders.
// UsageCleanupTask is the predicate function for usagecleanuptask builders.
type
UsageCleanupTask
func
(
*
sql
.
Selector
)
type
UsageCleanupTask
func
(
*
sql
.
Selector
)
...
...
backend/ent/runtime/runtime.go
View file @
b6d46fd5
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/schema"
"github.com/Wei-Shaw/sub2api/ent/schema"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagecleanuptask"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/usagelog"
"github.com/Wei-Shaw/sub2api/ent/user"
"github.com/Wei-Shaw/sub2api/ent/user"
...
@@ -746,6 +747,43 @@ func init() {
...
@@ -746,6 +747,43 @@ func init() {
setting
.
DefaultUpdatedAt
=
settingDescUpdatedAt
.
Default
.
(
func
()
time
.
Time
)
setting
.
DefaultUpdatedAt
=
settingDescUpdatedAt
.
Default
.
(
func
()
time
.
Time
)
// setting.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
// setting.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
setting
.
UpdateDefaultUpdatedAt
=
settingDescUpdatedAt
.
UpdateDefault
.
(
func
()
time
.
Time
)
setting
.
UpdateDefaultUpdatedAt
=
settingDescUpdatedAt
.
UpdateDefault
.
(
func
()
time
.
Time
)
tlsfingerprintprofileMixin
:=
schema
.
TLSFingerprintProfile
{}
.
Mixin
()
tlsfingerprintprofileMixinFields0
:=
tlsfingerprintprofileMixin
[
0
]
.
Fields
()
_
=
tlsfingerprintprofileMixinFields0
tlsfingerprintprofileFields
:=
schema
.
TLSFingerprintProfile
{}
.
Fields
()
_
=
tlsfingerprintprofileFields
// tlsfingerprintprofileDescCreatedAt is the schema descriptor for created_at field.
tlsfingerprintprofileDescCreatedAt
:=
tlsfingerprintprofileMixinFields0
[
0
]
.
Descriptor
()
// tlsfingerprintprofile.DefaultCreatedAt holds the default value on creation for the created_at field.
tlsfingerprintprofile
.
DefaultCreatedAt
=
tlsfingerprintprofileDescCreatedAt
.
Default
.
(
func
()
time
.
Time
)
// tlsfingerprintprofileDescUpdatedAt is the schema descriptor for updated_at field.
tlsfingerprintprofileDescUpdatedAt
:=
tlsfingerprintprofileMixinFields0
[
1
]
.
Descriptor
()
// tlsfingerprintprofile.DefaultUpdatedAt holds the default value on creation for the updated_at field.
tlsfingerprintprofile
.
DefaultUpdatedAt
=
tlsfingerprintprofileDescUpdatedAt
.
Default
.
(
func
()
time
.
Time
)
// tlsfingerprintprofile.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
tlsfingerprintprofile
.
UpdateDefaultUpdatedAt
=
tlsfingerprintprofileDescUpdatedAt
.
UpdateDefault
.
(
func
()
time
.
Time
)
// tlsfingerprintprofileDescName is the schema descriptor for name field.
tlsfingerprintprofileDescName
:=
tlsfingerprintprofileFields
[
0
]
.
Descriptor
()
// tlsfingerprintprofile.NameValidator is a validator for the "name" field. It is called by the builders before save.
tlsfingerprintprofile
.
NameValidator
=
func
()
func
(
string
)
error
{
validators
:=
tlsfingerprintprofileDescName
.
Validators
fns
:=
[
...
]
func
(
string
)
error
{
validators
[
0
]
.
(
func
(
string
)
error
),
validators
[
1
]
.
(
func
(
string
)
error
),
}
return
func
(
name
string
)
error
{
for
_
,
fn
:=
range
fns
{
if
err
:=
fn
(
name
);
err
!=
nil
{
return
err
}
}
return
nil
}
}()
// tlsfingerprintprofileDescEnableGrease is the schema descriptor for enable_grease field.
tlsfingerprintprofileDescEnableGrease
:=
tlsfingerprintprofileFields
[
2
]
.
Descriptor
()
// tlsfingerprintprofile.DefaultEnableGrease holds the default value on creation for the enable_grease field.
tlsfingerprintprofile
.
DefaultEnableGrease
=
tlsfingerprintprofileDescEnableGrease
.
Default
.
(
bool
)
usagecleanuptaskMixin
:=
schema
.
UsageCleanupTask
{}
.
Mixin
()
usagecleanuptaskMixin
:=
schema
.
UsageCleanupTask
{}
.
Mixin
()
usagecleanuptaskMixinFields0
:=
usagecleanuptaskMixin
[
0
]
.
Fields
()
usagecleanuptaskMixinFields0
:=
usagecleanuptaskMixin
[
0
]
.
Fields
()
_
=
usagecleanuptaskMixinFields0
_
=
usagecleanuptaskMixinFields0
...
...
backend/ent/schema/tls_fingerprint_profile.go
0 → 100644
View file @
b6d46fd5
// Package schema 定义 Ent ORM 的数据库 schema。
package
schema
import
(
"github.com/Wei-Shaw/sub2api/ent/schema/mixins"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
)
// TLSFingerprintProfile 定义 TLS 指纹配置模板的 schema。
//
// TLS 指纹模板用于模拟特定客户端(如 Claude Code / Node.js)的 TLS 握手特征。
// 每个模板包含完整的 ClientHello 参数:加密套件、曲线、扩展等。
// 通过 Account.Extra.tls_fingerprint_profile_id 绑定到具体账号。
type
TLSFingerprintProfile
struct
{
ent
.
Schema
}
// Annotations 返回 schema 的注解配置。
func
(
TLSFingerprintProfile
)
Annotations
()
[]
schema
.
Annotation
{
return
[]
schema
.
Annotation
{
entsql
.
Annotation
{
Table
:
"tls_fingerprint_profiles"
},
}
}
// Mixin 返回该 schema 使用的混入组件。
func
(
TLSFingerprintProfile
)
Mixin
()
[]
ent
.
Mixin
{
return
[]
ent
.
Mixin
{
mixins
.
TimeMixin
{},
}
}
// Fields 定义 TLS 指纹模板实体的所有字段。
func
(
TLSFingerprintProfile
)
Fields
()
[]
ent
.
Field
{
return
[]
ent
.
Field
{
// name: 模板名称,唯一标识
field
.
String
(
"name"
)
.
MaxLen
(
100
)
.
NotEmpty
()
.
Unique
(),
// description: 模板描述
field
.
Text
(
"description"
)
.
Optional
()
.
Nillable
(),
// enable_grease: 是否启用 GREASE 扩展(Chrome 使用,Node.js 不使用)
field
.
Bool
(
"enable_grease"
)
.
Default
(
false
),
// cipher_suites: TLS 加密套件列表(顺序敏感,影响 JA3)
field
.
JSON
(
"cipher_suites"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// curves: 椭圆曲线/支持的组列表
field
.
JSON
(
"curves"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// point_formats: EC 点格式列表
field
.
JSON
(
"point_formats"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// signature_algorithms: 签名算法列表
field
.
JSON
(
"signature_algorithms"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// alpn_protocols: ALPN 协议列表(如 ["http/1.1"])
field
.
JSON
(
"alpn_protocols"
,
[]
string
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// supported_versions: 支持的 TLS 版本列表(如 [0x0304, 0x0303])
field
.
JSON
(
"supported_versions"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// key_share_groups: Key Share 中发送的曲线组(如 [29] 即 X25519)
field
.
JSON
(
"key_share_groups"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// psk_modes: PSK 密钥交换模式(如 [1] 即 psk_dhe_ke)
field
.
JSON
(
"psk_modes"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
// extensions: TLS 扩展类型 ID 列表,按发送顺序排列
field
.
JSON
(
"extensions"
,
[]
uint16
{})
.
Optional
()
.
SchemaType
(
map
[
string
]
string
{
dialect
.
Postgres
:
"jsonb"
}),
}
}
backend/ent/tlsfingerprintprofile.go
0 → 100644
View file @
b6d46fd5
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"encoding/json"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
)
// TLSFingerprintProfile is the model entity for the TLSFingerprintProfile schema.
type
TLSFingerprintProfile
struct
{
config
`json:"-"`
// ID of the ent.
ID
int64
`json:"id,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt
time
.
Time
`json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt
time
.
Time
`json:"updated_at,omitempty"`
// Name holds the value of the "name" field.
Name
string
`json:"name,omitempty"`
// Description holds the value of the "description" field.
Description
*
string
`json:"description,omitempty"`
// EnableGrease holds the value of the "enable_grease" field.
EnableGrease
bool
`json:"enable_grease,omitempty"`
// CipherSuites holds the value of the "cipher_suites" field.
CipherSuites
[]
uint16
`json:"cipher_suites,omitempty"`
// Curves holds the value of the "curves" field.
Curves
[]
uint16
`json:"curves,omitempty"`
// PointFormats holds the value of the "point_formats" field.
PointFormats
[]
uint16
`json:"point_formats,omitempty"`
// SignatureAlgorithms holds the value of the "signature_algorithms" field.
SignatureAlgorithms
[]
uint16
`json:"signature_algorithms,omitempty"`
// AlpnProtocols holds the value of the "alpn_protocols" field.
AlpnProtocols
[]
string
`json:"alpn_protocols,omitempty"`
// SupportedVersions holds the value of the "supported_versions" field.
SupportedVersions
[]
uint16
`json:"supported_versions,omitempty"`
// KeyShareGroups holds the value of the "key_share_groups" field.
KeyShareGroups
[]
uint16
`json:"key_share_groups,omitempty"`
// PskModes holds the value of the "psk_modes" field.
PskModes
[]
uint16
`json:"psk_modes,omitempty"`
// Extensions holds the value of the "extensions" field.
Extensions
[]
uint16
`json:"extensions,omitempty"`
selectValues
sql
.
SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func
(
*
TLSFingerprintProfile
)
scanValues
(
columns
[]
string
)
([]
any
,
error
)
{
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
tlsfingerprintprofile
.
FieldCipherSuites
,
tlsfingerprintprofile
.
FieldCurves
,
tlsfingerprintprofile
.
FieldPointFormats
,
tlsfingerprintprofile
.
FieldSignatureAlgorithms
,
tlsfingerprintprofile
.
FieldAlpnProtocols
,
tlsfingerprintprofile
.
FieldSupportedVersions
,
tlsfingerprintprofile
.
FieldKeyShareGroups
,
tlsfingerprintprofile
.
FieldPskModes
,
tlsfingerprintprofile
.
FieldExtensions
:
values
[
i
]
=
new
([]
byte
)
case
tlsfingerprintprofile
.
FieldEnableGrease
:
values
[
i
]
=
new
(
sql
.
NullBool
)
case
tlsfingerprintprofile
.
FieldID
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
case
tlsfingerprintprofile
.
FieldName
,
tlsfingerprintprofile
.
FieldDescription
:
values
[
i
]
=
new
(
sql
.
NullString
)
case
tlsfingerprintprofile
.
FieldCreatedAt
,
tlsfingerprintprofile
.
FieldUpdatedAt
:
values
[
i
]
=
new
(
sql
.
NullTime
)
default
:
values
[
i
]
=
new
(
sql
.
UnknownType
)
}
}
return
values
,
nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the TLSFingerprintProfile fields.
func
(
_m
*
TLSFingerprintProfile
)
assignValues
(
columns
[]
string
,
values
[]
any
)
error
{
if
m
,
n
:=
len
(
values
),
len
(
columns
);
m
<
n
{
return
fmt
.
Errorf
(
"mismatch number of scan values: %d != %d"
,
m
,
n
)
}
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
tlsfingerprintprofile
.
FieldID
:
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
)
if
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field id"
,
value
)
}
_m
.
ID
=
int64
(
value
.
Int64
)
case
tlsfingerprintprofile
.
FieldCreatedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field created_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CreatedAt
=
value
.
Time
}
case
tlsfingerprintprofile
.
FieldUpdatedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field updated_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
UpdatedAt
=
value
.
Time
}
case
tlsfingerprintprofile
.
FieldName
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field name"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Name
=
value
.
String
}
case
tlsfingerprintprofile
.
FieldDescription
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field description"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Description
=
new
(
string
)
*
_m
.
Description
=
value
.
String
}
case
tlsfingerprintprofile
.
FieldEnableGrease
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullBool
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field enable_grease"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
EnableGrease
=
value
.
Bool
}
case
tlsfingerprintprofile
.
FieldCipherSuites
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field cipher_suites"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
CipherSuites
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field cipher_suites: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldCurves
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field curves"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
Curves
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field curves: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldPointFormats
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field point_formats"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
PointFormats
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field point_formats: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldSignatureAlgorithms
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field signature_algorithms"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
SignatureAlgorithms
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field signature_algorithms: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldAlpnProtocols
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field alpn_protocols"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
AlpnProtocols
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field alpn_protocols: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldSupportedVersions
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field supported_versions"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
SupportedVersions
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field supported_versions: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldKeyShareGroups
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field key_share_groups"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
KeyShareGroups
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field key_share_groups: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldPskModes
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field psk_modes"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
PskModes
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field psk_modes: %w"
,
err
)
}
}
case
tlsfingerprintprofile
.
FieldExtensions
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field extensions"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
Extensions
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field extensions: %w"
,
err
)
}
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
}
return
nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the TLSFingerprintProfile.
// This includes values selected through modifiers, order, etc.
func
(
_m
*
TLSFingerprintProfile
)
Value
(
name
string
)
(
ent
.
Value
,
error
)
{
return
_m
.
selectValues
.
Get
(
name
)
}
// Update returns a builder for updating this TLSFingerprintProfile.
// Note that you need to call TLSFingerprintProfile.Unwrap() before calling this method if this TLSFingerprintProfile
// was returned from a transaction, and the transaction was committed or rolled back.
func
(
_m
*
TLSFingerprintProfile
)
Update
()
*
TLSFingerprintProfileUpdateOne
{
return
NewTLSFingerprintProfileClient
(
_m
.
config
)
.
UpdateOne
(
_m
)
}
// Unwrap unwraps the TLSFingerprintProfile entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func
(
_m
*
TLSFingerprintProfile
)
Unwrap
()
*
TLSFingerprintProfile
{
_tx
,
ok
:=
_m
.
config
.
driver
.
(
*
txDriver
)
if
!
ok
{
panic
(
"ent: TLSFingerprintProfile is not a transactional entity"
)
}
_m
.
config
.
driver
=
_tx
.
drv
return
_m
}
// String implements the fmt.Stringer.
func
(
_m
*
TLSFingerprintProfile
)
String
()
string
{
var
builder
strings
.
Builder
builder
.
WriteString
(
"TLSFingerprintProfile("
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"id=%v, "
,
_m
.
ID
))
builder
.
WriteString
(
"created_at="
)
builder
.
WriteString
(
_m
.
CreatedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"updated_at="
)
builder
.
WriteString
(
_m
.
UpdatedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"name="
)
builder
.
WriteString
(
_m
.
Name
)
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
Description
;
v
!=
nil
{
builder
.
WriteString
(
"description="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"enable_grease="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
EnableGrease
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"cipher_suites="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
CipherSuites
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"curves="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
Curves
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"point_formats="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
PointFormats
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"signature_algorithms="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
SignatureAlgorithms
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"alpn_protocols="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
AlpnProtocols
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"supported_versions="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
SupportedVersions
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"key_share_groups="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
KeyShareGroups
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"psk_modes="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
PskModes
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"extensions="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
Extensions
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
// TLSFingerprintProfiles is a parsable slice of TLSFingerprintProfile.
type
TLSFingerprintProfiles
[]
*
TLSFingerprintProfile
backend/ent/tlsfingerprintprofile/tlsfingerprintprofile.go
0 → 100644
View file @
b6d46fd5
// Code generated by ent, DO NOT EDIT.
package
tlsfingerprintprofile
import
(
"time"
"entgo.io/ent/dialect/sql"
)
const
(
// Label holds the string label denoting the tlsfingerprintprofile type in the database.
Label
=
"tls_fingerprint_profile"
// FieldID holds the string denoting the id field in the database.
FieldID
=
"id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt
=
"created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt
=
"updated_at"
// FieldName holds the string denoting the name field in the database.
FieldName
=
"name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription
=
"description"
// FieldEnableGrease holds the string denoting the enable_grease field in the database.
FieldEnableGrease
=
"enable_grease"
// FieldCipherSuites holds the string denoting the cipher_suites field in the database.
FieldCipherSuites
=
"cipher_suites"
// FieldCurves holds the string denoting the curves field in the database.
FieldCurves
=
"curves"
// FieldPointFormats holds the string denoting the point_formats field in the database.
FieldPointFormats
=
"point_formats"
// FieldSignatureAlgorithms holds the string denoting the signature_algorithms field in the database.
FieldSignatureAlgorithms
=
"signature_algorithms"
// FieldAlpnProtocols holds the string denoting the alpn_protocols field in the database.
FieldAlpnProtocols
=
"alpn_protocols"
// FieldSupportedVersions holds the string denoting the supported_versions field in the database.
FieldSupportedVersions
=
"supported_versions"
// FieldKeyShareGroups holds the string denoting the key_share_groups field in the database.
FieldKeyShareGroups
=
"key_share_groups"
// FieldPskModes holds the string denoting the psk_modes field in the database.
FieldPskModes
=
"psk_modes"
// FieldExtensions holds the string denoting the extensions field in the database.
FieldExtensions
=
"extensions"
// Table holds the table name of the tlsfingerprintprofile in the database.
Table
=
"tls_fingerprint_profiles"
)
// Columns holds all SQL columns for tlsfingerprintprofile fields.
var
Columns
=
[]
string
{
FieldID
,
FieldCreatedAt
,
FieldUpdatedAt
,
FieldName
,
FieldDescription
,
FieldEnableGrease
,
FieldCipherSuites
,
FieldCurves
,
FieldPointFormats
,
FieldSignatureAlgorithms
,
FieldAlpnProtocols
,
FieldSupportedVersions
,
FieldKeyShareGroups
,
FieldPskModes
,
FieldExtensions
,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func
ValidColumn
(
column
string
)
bool
{
for
i
:=
range
Columns
{
if
column
==
Columns
[
i
]
{
return
true
}
}
return
false
}
var
(
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt
func
()
time
.
Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt
func
()
time
.
Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt
func
()
time
.
Time
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator
func
(
string
)
error
// DefaultEnableGrease holds the default value on creation for the "enable_grease" field.
DefaultEnableGrease
bool
)
// OrderOption defines the ordering options for the TLSFingerprintProfile queries.
type
OrderOption
func
(
*
sql
.
Selector
)
// ByID orders the results by the id field.
func
ByID
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldID
,
opts
...
)
.
ToFunc
()
}
// ByCreatedAt orders the results by the created_at field.
func
ByCreatedAt
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCreatedAt
,
opts
...
)
.
ToFunc
()
}
// ByUpdatedAt orders the results by the updated_at field.
func
ByUpdatedAt
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldUpdatedAt
,
opts
...
)
.
ToFunc
()
}
// ByName orders the results by the name field.
func
ByName
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldName
,
opts
...
)
.
ToFunc
()
}
// ByDescription orders the results by the description field.
func
ByDescription
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldDescription
,
opts
...
)
.
ToFunc
()
}
// ByEnableGrease orders the results by the enable_grease field.
func
ByEnableGrease
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldEnableGrease
,
opts
...
)
.
ToFunc
()
}
backend/ent/tlsfingerprintprofile/where.go
0 → 100644
View file @
b6d46fd5
// Code generated by ent, DO NOT EDIT.
package
tlsfingerprintprofile
import
(
"time"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ID filters vertices based on their ID field.
func
ID
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDEQ applies the EQ predicate on the ID field.
func
IDEQ
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDNEQ applies the NEQ predicate on the ID field.
func
IDNEQ
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNEQ
(
FieldID
,
id
))
}
// IDIn applies the In predicate on the ID field.
func
IDIn
(
ids
...
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIn
(
FieldID
,
ids
...
))
}
// IDNotIn applies the NotIn predicate on the ID field.
func
IDNotIn
(
ids
...
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotIn
(
FieldID
,
ids
...
))
}
// IDGT applies the GT predicate on the ID field.
func
IDGT
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGT
(
FieldID
,
id
))
}
// IDGTE applies the GTE predicate on the ID field.
func
IDGTE
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGTE
(
FieldID
,
id
))
}
// IDLT applies the LT predicate on the ID field.
func
IDLT
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLT
(
FieldID
,
id
))
}
// IDLTE applies the LTE predicate on the ID field.
func
IDLTE
(
id
int64
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLTE
(
FieldID
,
id
))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func
CreatedAt
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func
UpdatedAt
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldUpdatedAt
,
v
))
}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
func
Name
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldName
,
v
))
}
// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ.
func
Description
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldDescription
,
v
))
}
// EnableGrease applies equality check predicate on the "enable_grease" field. It's identical to EnableGreaseEQ.
func
EnableGrease
(
v
bool
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldEnableGrease
,
v
))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func
CreatedAtEQ
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func
CreatedAtNEQ
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNEQ
(
FieldCreatedAt
,
v
))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func
CreatedAtIn
(
vs
...
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIn
(
FieldCreatedAt
,
vs
...
))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func
CreatedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotIn
(
FieldCreatedAt
,
vs
...
))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func
CreatedAtGT
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGT
(
FieldCreatedAt
,
v
))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func
CreatedAtGTE
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGTE
(
FieldCreatedAt
,
v
))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func
CreatedAtLT
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLT
(
FieldCreatedAt
,
v
))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func
CreatedAtLTE
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLTE
(
FieldCreatedAt
,
v
))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func
UpdatedAtEQ
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func
UpdatedAtNEQ
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNEQ
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func
UpdatedAtIn
(
vs
...
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIn
(
FieldUpdatedAt
,
vs
...
))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func
UpdatedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotIn
(
FieldUpdatedAt
,
vs
...
))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func
UpdatedAtGT
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGT
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func
UpdatedAtGTE
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGTE
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func
UpdatedAtLT
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLT
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func
UpdatedAtLTE
(
v
time
.
Time
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLTE
(
FieldUpdatedAt
,
v
))
}
// NameEQ applies the EQ predicate on the "name" field.
func
NameEQ
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldName
,
v
))
}
// NameNEQ applies the NEQ predicate on the "name" field.
func
NameNEQ
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNEQ
(
FieldName
,
v
))
}
// NameIn applies the In predicate on the "name" field.
func
NameIn
(
vs
...
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIn
(
FieldName
,
vs
...
))
}
// NameNotIn applies the NotIn predicate on the "name" field.
func
NameNotIn
(
vs
...
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotIn
(
FieldName
,
vs
...
))
}
// NameGT applies the GT predicate on the "name" field.
func
NameGT
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGT
(
FieldName
,
v
))
}
// NameGTE applies the GTE predicate on the "name" field.
func
NameGTE
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGTE
(
FieldName
,
v
))
}
// NameLT applies the LT predicate on the "name" field.
func
NameLT
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLT
(
FieldName
,
v
))
}
// NameLTE applies the LTE predicate on the "name" field.
func
NameLTE
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLTE
(
FieldName
,
v
))
}
// NameContains applies the Contains predicate on the "name" field.
func
NameContains
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldContains
(
FieldName
,
v
))
}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
func
NameHasPrefix
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldHasPrefix
(
FieldName
,
v
))
}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
func
NameHasSuffix
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldHasSuffix
(
FieldName
,
v
))
}
// NameEqualFold applies the EqualFold predicate on the "name" field.
func
NameEqualFold
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEqualFold
(
FieldName
,
v
))
}
// NameContainsFold applies the ContainsFold predicate on the "name" field.
func
NameContainsFold
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldContainsFold
(
FieldName
,
v
))
}
// DescriptionEQ applies the EQ predicate on the "description" field.
func
DescriptionEQ
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldDescription
,
v
))
}
// DescriptionNEQ applies the NEQ predicate on the "description" field.
func
DescriptionNEQ
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNEQ
(
FieldDescription
,
v
))
}
// DescriptionIn applies the In predicate on the "description" field.
func
DescriptionIn
(
vs
...
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIn
(
FieldDescription
,
vs
...
))
}
// DescriptionNotIn applies the NotIn predicate on the "description" field.
func
DescriptionNotIn
(
vs
...
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotIn
(
FieldDescription
,
vs
...
))
}
// DescriptionGT applies the GT predicate on the "description" field.
func
DescriptionGT
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGT
(
FieldDescription
,
v
))
}
// DescriptionGTE applies the GTE predicate on the "description" field.
func
DescriptionGTE
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldGTE
(
FieldDescription
,
v
))
}
// DescriptionLT applies the LT predicate on the "description" field.
func
DescriptionLT
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLT
(
FieldDescription
,
v
))
}
// DescriptionLTE applies the LTE predicate on the "description" field.
func
DescriptionLTE
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldLTE
(
FieldDescription
,
v
))
}
// DescriptionContains applies the Contains predicate on the "description" field.
func
DescriptionContains
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldContains
(
FieldDescription
,
v
))
}
// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field.
func
DescriptionHasPrefix
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldHasPrefix
(
FieldDescription
,
v
))
}
// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field.
func
DescriptionHasSuffix
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldHasSuffix
(
FieldDescription
,
v
))
}
// DescriptionIsNil applies the IsNil predicate on the "description" field.
func
DescriptionIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldDescription
))
}
// DescriptionNotNil applies the NotNil predicate on the "description" field.
func
DescriptionNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldDescription
))
}
// DescriptionEqualFold applies the EqualFold predicate on the "description" field.
func
DescriptionEqualFold
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEqualFold
(
FieldDescription
,
v
))
}
// DescriptionContainsFold applies the ContainsFold predicate on the "description" field.
func
DescriptionContainsFold
(
v
string
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldContainsFold
(
FieldDescription
,
v
))
}
// EnableGreaseEQ applies the EQ predicate on the "enable_grease" field.
func
EnableGreaseEQ
(
v
bool
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldEQ
(
FieldEnableGrease
,
v
))
}
// EnableGreaseNEQ applies the NEQ predicate on the "enable_grease" field.
func
EnableGreaseNEQ
(
v
bool
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNEQ
(
FieldEnableGrease
,
v
))
}
// CipherSuitesIsNil applies the IsNil predicate on the "cipher_suites" field.
func
CipherSuitesIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldCipherSuites
))
}
// CipherSuitesNotNil applies the NotNil predicate on the "cipher_suites" field.
func
CipherSuitesNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldCipherSuites
))
}
// CurvesIsNil applies the IsNil predicate on the "curves" field.
func
CurvesIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldCurves
))
}
// CurvesNotNil applies the NotNil predicate on the "curves" field.
func
CurvesNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldCurves
))
}
// PointFormatsIsNil applies the IsNil predicate on the "point_formats" field.
func
PointFormatsIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldPointFormats
))
}
// PointFormatsNotNil applies the NotNil predicate on the "point_formats" field.
func
PointFormatsNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldPointFormats
))
}
// SignatureAlgorithmsIsNil applies the IsNil predicate on the "signature_algorithms" field.
func
SignatureAlgorithmsIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldSignatureAlgorithms
))
}
// SignatureAlgorithmsNotNil applies the NotNil predicate on the "signature_algorithms" field.
func
SignatureAlgorithmsNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldSignatureAlgorithms
))
}
// AlpnProtocolsIsNil applies the IsNil predicate on the "alpn_protocols" field.
func
AlpnProtocolsIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldAlpnProtocols
))
}
// AlpnProtocolsNotNil applies the NotNil predicate on the "alpn_protocols" field.
func
AlpnProtocolsNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldAlpnProtocols
))
}
// SupportedVersionsIsNil applies the IsNil predicate on the "supported_versions" field.
func
SupportedVersionsIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldSupportedVersions
))
}
// SupportedVersionsNotNil applies the NotNil predicate on the "supported_versions" field.
func
SupportedVersionsNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldSupportedVersions
))
}
// KeyShareGroupsIsNil applies the IsNil predicate on the "key_share_groups" field.
func
KeyShareGroupsIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldKeyShareGroups
))
}
// KeyShareGroupsNotNil applies the NotNil predicate on the "key_share_groups" field.
func
KeyShareGroupsNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldKeyShareGroups
))
}
// PskModesIsNil applies the IsNil predicate on the "psk_modes" field.
func
PskModesIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldPskModes
))
}
// PskModesNotNil applies the NotNil predicate on the "psk_modes" field.
func
PskModesNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldPskModes
))
}
// ExtensionsIsNil applies the IsNil predicate on the "extensions" field.
func
ExtensionsIsNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldIsNull
(
FieldExtensions
))
}
// ExtensionsNotNil applies the NotNil predicate on the "extensions" field.
func
ExtensionsNotNil
()
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
FieldNotNull
(
FieldExtensions
))
}
// And groups predicates with the AND operator between them.
func
And
(
predicates
...
predicate
.
TLSFingerprintProfile
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
AndPredicates
(
predicates
...
))
}
// Or groups predicates with the OR operator between them.
func
Or
(
predicates
...
predicate
.
TLSFingerprintProfile
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
OrPredicates
(
predicates
...
))
}
// Not applies the not operator on the given predicate.
func
Not
(
p
predicate
.
TLSFingerprintProfile
)
predicate
.
TLSFingerprintProfile
{
return
predicate
.
TLSFingerprintProfile
(
sql
.
NotPredicates
(
p
))
}
backend/ent/tlsfingerprintprofile_create.go
0 → 100644
View file @
b6d46fd5
This diff is collapsed.
Click to expand it.
backend/ent/tlsfingerprintprofile_delete.go
0 → 100644
View file @
b6d46fd5
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/predicate"
"github.com/Wei-Shaw/sub2api/ent/tlsfingerprintprofile"
)
// TLSFingerprintProfileDelete is the builder for deleting a TLSFingerprintProfile entity.
type
TLSFingerprintProfileDelete
struct
{
config
hooks
[]
Hook
mutation
*
TLSFingerprintProfileMutation
}
// Where appends a list predicates to the TLSFingerprintProfileDelete builder.
func
(
_d
*
TLSFingerprintProfileDelete
)
Where
(
ps
...
predicate
.
TLSFingerprintProfile
)
*
TLSFingerprintProfileDelete
{
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func
(
_d
*
TLSFingerprintProfileDelete
)
Exec
(
ctx
context
.
Context
)
(
int
,
error
)
{
return
withHooks
(
ctx
,
_d
.
sqlExec
,
_d
.
mutation
,
_d
.
hooks
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
TLSFingerprintProfileDelete
)
ExecX
(
ctx
context
.
Context
)
int
{
n
,
err
:=
_d
.
Exec
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
n
}
func
(
_d
*
TLSFingerprintProfileDelete
)
sqlExec
(
ctx
context
.
Context
)
(
int
,
error
)
{
_spec
:=
sqlgraph
.
NewDeleteSpec
(
tlsfingerprintprofile
.
Table
,
sqlgraph
.
NewFieldSpec
(
tlsfingerprintprofile
.
FieldID
,
field
.
TypeInt64
))
if
ps
:=
_d
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
affected
,
err
:=
sqlgraph
.
DeleteNodes
(
ctx
,
_d
.
driver
,
_spec
)
if
err
!=
nil
&&
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
_d
.
mutation
.
done
=
true
return
affected
,
err
}
// TLSFingerprintProfileDeleteOne is the builder for deleting a single TLSFingerprintProfile entity.
type
TLSFingerprintProfileDeleteOne
struct
{
_d
*
TLSFingerprintProfileDelete
}
// Where appends a list predicates to the TLSFingerprintProfileDelete builder.
func
(
_d
*
TLSFingerprintProfileDeleteOne
)
Where
(
ps
...
predicate
.
TLSFingerprintProfile
)
*
TLSFingerprintProfileDeleteOne
{
_d
.
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query.
func
(
_d
*
TLSFingerprintProfileDeleteOne
)
Exec
(
ctx
context
.
Context
)
error
{
n
,
err
:=
_d
.
_d
.
Exec
(
ctx
)
switch
{
case
err
!=
nil
:
return
err
case
n
==
0
:
return
&
NotFoundError
{
tlsfingerprintprofile
.
Label
}
default
:
return
nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
TLSFingerprintProfileDeleteOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_d
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/tlsfingerprintprofile_query.go
0 → 100644
View file @
b6d46fd5
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment