mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-31 04:57:45 +09:00 
			
		
		
		
	Merge branch 'main' into kradalby-patch-2
This commit is contained in:
		
							
								
								
									
										2
									
								
								app.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								app.go
									
									
									
									
									
								
							| @@ -48,7 +48,7 @@ import ( | |||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	AuthPrefix      = "Bearer " | 	AuthPrefix      = "Bearer " | ||||||
| 	Postgres        = "postgresql" | 	Postgres        = "postgres" | ||||||
| 	Sqlite          = "sqlite3" | 	Sqlite          = "sqlite3" | ||||||
| 	updateInterval  = 5000 | 	updateInterval  = 5000 | ||||||
| 	HTTPReadTimeout = 30 * time.Second | 	HTTPReadTimeout = 30 * time.Second | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	DefaultPreAuthKeyExpiry = 24 * time.Hour | 	DefaultPreAuthKeyExpiry = 1 * time.Hour | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -145,14 +145,12 @@ var createPreAuthKeyCmd = &cobra.Command{ | |||||||
| 			Ephemeral: ephemeral, | 			Ephemeral: ephemeral, | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if cmd.Flags().Changed("expiration") { | 		duration, _ := cmd.Flags().GetDuration("expiration") | ||||||
| 			duration, _ := cmd.Flags().GetDuration("expiration") | 		expiration := time.Now().UTC().Add(duration) | ||||||
| 			expiration := time.Now().UTC().Add(duration) |  | ||||||
|  |  | ||||||
| 			log.Trace().Dur("expiration", duration).Msg("expiration has been set") | 		log.Trace().Dur("expiration", duration).Msg("expiration has been set") | ||||||
|  |  | ||||||
| 			request.Expiration = timestamppb.New(expiration) | 		request.Expiration = timestamppb.New(expiration) | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		ctx, client, conn, cancel := getHeadscaleCLIClient() | 		ctx, client, conn, cancel := getHeadscaleCLIClient() | ||||||
| 		defer cancel() | 		defer cancel() | ||||||
|   | |||||||
| @@ -426,7 +426,12 @@ func (s *IntegrationCLITestSuite) TestPreAuthKeyCommandWithoutExpiry() { | |||||||
| 	assert.Nil(s.T(), err) | 	assert.Nil(s.T(), err) | ||||||
|  |  | ||||||
| 	assert.Len(s.T(), listedPreAuthKeys, 1) | 	assert.Len(s.T(), listedPreAuthKeys, 1) | ||||||
| 	assert.True(s.T(), time.Time{}.Equal(listedPreAuthKeys[0].Expiration.AsTime())) |  | ||||||
|  | 	assert.True(s.T(), listedPreAuthKeys[0].Expiration.AsTime().After(time.Now())) | ||||||
|  | 	assert.True( | ||||||
|  | 		s.T(), | ||||||
|  | 		listedPreAuthKeys[0].Expiration.AsTime().Before(time.Now().Add(time.Minute*70)), | ||||||
|  | 	) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s *IntegrationCLITestSuite) TestPreAuthKeyCommandReusableEphemeral() { | func (s *IntegrationCLITestSuite) TestPreAuthKeyCommandReusableEphemeral() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user