27 lines
		
	
	
		
			513 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			513 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package config
 | |
| 
 | |
| import "time"
 | |
| 
 | |
| const (
 | |
| 	ConfigFileName = "auth.json"
 | |
| )
 | |
| 
 | |
| type AuthStateType int
 | |
| 
 | |
| const (
 | |
| 	AuthStateTypeNotRegisterd AuthStateType = iota
 | |
| 	AuthStateTypeRegisterd
 | |
| )
 | |
| 
 | |
| type Auth struct {
 | |
| 	TempKey  *string    `json:"tempKey,omitempty" yaml:"tempKey" toml:"tempKey"`
 | |
| 	DenyDate *time.Time `json:"denyDate,omitempty" yaml:"denyDate" toml:"denyDate"`
 | |
| }
 | |
| 
 | |
| func (a *Auth) State() AuthStateType {
 | |
| 	if nil != a.TempKey && "" != *a.TempKey {
 | |
| 		return AuthStateTypeRegisterd
 | |
| 	}
 | |
| 	return AuthStateTypeNotRegisterd
 | |
| }
 |