Documentation
¶
Index ¶
- Variables
- func AutoMigrate(ctx context.Context, db *sql.DB, cfg *AppConfig) error
- func GetConfigDir() string
- func GetConfigPath() string
- func GetContracts(ctx context.Context, db *sql.DB, chainName string, limit int) ([]internal.Contract, error)
- func GetContractsByAddresses(ctx context.Context, db *sql.DB, chainName string, addresses []string) ([]internal.Contract, error)
- func GetTableName(chainName string) (string, error)
- func InitDB(ctx context.Context) (*sql.DB, error)
- type AIConfig
- type AIProvider
- type APIKeyManager
- type AppConfig
- type BlockRange
- type ChainConfig
- type DatabaseConfig
- type Explorer
- type RPCManager
- type ScanConfiguration
Constants ¶
This section is empty.
Variables ¶
View Source
var DBPool *sql.DB
Functions ¶
func AutoMigrate ¶
AutoMigrate 自动检查并创建所需的表
func GetConfigDir ¶
func GetConfigDir() string
func GetConfigPath ¶
func GetConfigPath() string
func GetContracts ¶
func GetContractsByAddresses ¶
func GetTableName ¶
Types ¶
type AIConfig ¶
type AIConfig struct {
OpenAI AIProvider `yaml:"openai"`
DeepSeek AIProvider `yaml:"deepseek"`
Gemini AIProvider `yaml:"gemini"`
LocalLLM AIProvider `yaml:"local_llm"`
}
type AIProvider ¶
type APIKeyManager ¶
type APIKeyManager struct {
// contains filtered or unexported fields
}
func GetAPIKeyManager ¶
func GetAPIKeyManager(chainName string) (*APIKeyManager, error)
func NewAPIKeyManager ¶
func NewAPIKeyManager(apiKeys []string, fallbackKey string) *APIKeyManager
func (*APIKeyManager) GetKey ¶
func (m *APIKeyManager) GetKey() string
func (*APIKeyManager) GetKeyCount ¶
func (m *APIKeyManager) GetKeyCount() int
func (*APIKeyManager) GetNextKey ¶
func (m *APIKeyManager) GetNextKey() string
func (*APIKeyManager) GetRandomKey ¶
func (m *APIKeyManager) GetRandomKey() string
func (*APIKeyManager) HasKeys ¶
func (m *APIKeyManager) HasKeys() bool
type AppConfig ¶
type AppConfig struct {
AI AIConfig `yaml:"ai"`
Chains map[string]ChainConfig `yaml:"chains"`
Database DatabaseConfig `yaml:"database"`
}
var GlobalConfig *AppConfig
func (*AppConfig) GetAIConfig ¶
func (c *AppConfig) GetAIConfig(provider string) (*AIProvider, error)
func (*AppConfig) GetChainConfig ¶
func (c *AppConfig) GetChainConfig(chainName string) (*ChainConfig, error)
func (*AppConfig) GetDatabaseDSN ¶
type BlockRange ¶
type ChainConfig ¶
type ChainConfig struct {
Name string `yaml:"name"`
ChainID int `yaml:"chain_id"`
RPCURLs []string `yaml:"rpc_urls"`
Explorer Explorer `yaml:"explorer"`
TableName string `yaml:"table_name"`
}
func GetChainConfig ¶
func GetChainConfig(chainName string) (*ChainConfig, error)
type DatabaseConfig ¶
type Explorer ¶
type Explorer struct {
APIKey string `yaml:"api_key"`
APIKeys []string `yaml:"api_keys"`
BaseURL string `yaml:"base_url"`
}
func GetExplorerConfig ¶
type RPCManager ¶
type RPCManager struct {
// contains filtered or unexported fields
}
func GetRPCManager ¶
func GetRPCManager(chainName string, proxy string) (*RPCManager, error)
func NewRPCManager ¶
func (*RPCManager) Close ¶
func (r *RPCManager) Close()
func (*RPCManager) GetChainName ¶
func (r *RPCManager) GetChainName() string
func (*RPCManager) GetCurrentURL ¶
func (r *RPCManager) GetCurrentURL() string
func (*RPCManager) GetStatus ¶
func (r *RPCManager) GetStatus() map[string]interface{}
type ScanConfiguration ¶
type ScanConfiguration struct {
// AI 相关
AIProvider string
APIKey string // 最终使用的 API Key
BaseURL string
Model string
Timeout time.Duration
// 扫描相关
Mode string
Strategy string
TargetSource string
TargetFile string
TargetAddress string
BlockRange *BlockRange
Chain string
Concurrency int
InputFile string
// 系统相关
Proxy string
Verbose bool
ReportDir string
// Benchmark related
Benchmark bool
Database string
}
func DefaultScanConfiguration ¶
func DefaultScanConfiguration() ScanConfiguration
Click to show internal directories.
Click to hide internal directories.