mirror of
				https://github.com/h44z/wg-portal.git
				synced 2025-11-04 08:06:18 +00:00 
			
		
		
		
	Fixes & API unit testing (#58)
* api - add OperationID helps when using pyswagger and is visible via http://localhost:8123/swagger/index.html?displayOperationId=true gin-swagger can not set displayOperationId yet * api - match paramters to their property equivalents pascalcase & sometimes replacing the name (e.g. device -> DeviceName) * api - use ShouldBindJSON instead of BindJSON BindJSON sets the content-type text/plain * api - we renamed, we regenerated * device - allow - in DeviceName wg-example0.conf etc * api - more pascalcase & argument renames * api - marshal DeletedAt as string gorm.DeletedAt is of type sql.NullTime NullTime declares Time & Valid as properties DeletedAt marshals as time.Time swaggertype allows only basic types -> string * Peer - export UID/DeviceType in json UID/DeviceType is required, skipping in json, skips it in marshalling, next unmarshalling fails * assets - name forms for use with mechanize * api - match error message * add python3/pyswagger based unittesting - initializes a clean install by configuration via web service - tests the rest api * tests - test address exhaustion * tests - test network expansion Co-authored-by: Markus Koetter <koetter@cispa.de>
This commit is contained in:
		
							
								
								
									
										27
									
								
								tests/conf/config.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/conf/config.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
core:
 | 
			
		||||
  listeningAddress: :8123
 | 
			
		||||
  externalUrl: https://wg.example.org
 | 
			
		||||
  title: Example WireGuard VPN
 | 
			
		||||
  company: Example.org
 | 
			
		||||
  mailFrom: WireGuard VPN <noreply+wg@example.org>
 | 
			
		||||
  logoUrl: /img/logo.png
 | 
			
		||||
  adminUser: wg@example.org
 | 
			
		||||
  adminPass: abadchoice
 | 
			
		||||
  editableKeys: true
 | 
			
		||||
  createDefaultPeer: true
 | 
			
		||||
  selfProvisioning: true
 | 
			
		||||
  ldapEnabled: false
 | 
			
		||||
database:
 | 
			
		||||
  typ: sqlite
 | 
			
		||||
  database: test.db
 | 
			
		||||
# :memory: does not work
 | 
			
		||||
email:
 | 
			
		||||
  host: 127.0.0.1
 | 
			
		||||
  port: 25
 | 
			
		||||
  tls: false
 | 
			
		||||
wg:
 | 
			
		||||
  devices:
 | 
			
		||||
    - wg-example0
 | 
			
		||||
  defaultDevice: wg-example0
 | 
			
		||||
  configDirectory: /etc/wireguard
 | 
			
		||||
  manageIPAddresses: true
 | 
			
		||||
							
								
								
									
										16
									
								
								tests/conf/wg-example0.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								tests/conf/wg-example0.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
# AUTOGENERATED FILE - DO NOT EDIT
 | 
			
		||||
# -WGP- Interface: wg-example / Updated: 2021-09-27 08:52:05.537618409 +0000 UTC / Created: 2021-09-24 10:06:46.903674496 +0000 UTC
 | 
			
		||||
# -WGP- Interface display name: TheInterface
 | 
			
		||||
# -WGP- Interface mode: server
 | 
			
		||||
# -WGP- PublicKey = HIgo9xNzJMWLKASShiTqIybxZ0U3wGLiUeJ1PKf8ykw=
 | 
			
		||||
 | 
			
		||||
[Interface]
 | 
			
		||||
 | 
			
		||||
# Core settings
 | 
			
		||||
PrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=
 | 
			
		||||
Address = 10.0.0.0/24
 | 
			
		||||
 | 
			
		||||
# Misc. settings (optional)
 | 
			
		||||
ListenPort = 51820
 | 
			
		||||
FwMark = 1
 | 
			
		||||
SaveConfig = true
 | 
			
		||||
		Reference in New Issue
	
	Block a user