mirror of
				https://github.com/onyx-and-iris/q3rcon.git
				synced 2025-11-03 23:11:48 +00:00 
			
		
		
		
	move option functions into option.go
This commit is contained in:
		
							parent
							
								
									8c1bc0f04c
								
							
						
					
					
						commit
						7d787324a7
					
				
							
								
								
									
										27
									
								
								option.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								option.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					package q3rcon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Option is a functional option type that allows us to configure the VbanTxt.
 | 
				
			||||||
 | 
					type Option func(*Rcon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WithLoginTimeout is a functional option to set the login timeout
 | 
				
			||||||
 | 
					func WithLoginTimeout(timeout time.Duration) Option {
 | 
				
			||||||
 | 
						return func(rcon *Rcon) {
 | 
				
			||||||
 | 
							rcon.loginTimeout = timeout
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WithDefaultTimeout is a functional option to set the default response timeout
 | 
				
			||||||
 | 
					func WithDefaultTimeout(timeout time.Duration) Option {
 | 
				
			||||||
 | 
						return func(rcon *Rcon) {
 | 
				
			||||||
 | 
							rcon.defaultTimeout = timeout
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// WithTimeouts is a functional option to set the timeouts for responses per command
 | 
				
			||||||
 | 
					func WithTimeouts(timeouts map[string]time.Duration) Option {
 | 
				
			||||||
 | 
						return func(rcon *Rcon) {
 | 
				
			||||||
 | 
							rcon.timeouts = timeouts
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user