Added support for tunneldigger usage based broker selection
This commit is contained in:
		
							parent
							
								
									6f2971a27b
								
							
						
					
					
						commit
						7b3c91a6e4
					
				@ -27,6 +27,7 @@ uci:section('tunneldigger', 'broker', section,
 | 
				
			|||||||
		  interface = 'mesh-vpn',
 | 
							  interface = 'mesh-vpn',
 | 
				
			||||||
		  bind_interface = 'br-wan',
 | 
							  bind_interface = 'br-wan',
 | 
				
			||||||
		  group = 'gluon-tunneldigger',
 | 
							  group = 'gluon-tunneldigger',
 | 
				
			||||||
 | 
							  broker_selection = 'usage',
 | 
				
			||||||
		  address = site.tunneldigger_mesh_vpn.brokers,
 | 
							  address = site.tunneldigger_mesh_vpn.brokers,
 | 
				
			||||||
	  }
 | 
						  }
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,12 +1,12 @@
 | 
				
			|||||||
include $(TOPDIR)/rules.mk
 | 
					include $(TOPDIR)/rules.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_NAME:=tunneldigger
 | 
					PKG_NAME:=tunneldigger
 | 
				
			||||||
PKG_VERSION:=0.4.4
 | 
					PKG_VERSION:=0.4.5
 | 
				
			||||||
PKG_RELEASE:=2
 | 
					PKG_RELEASE:=1
 | 
				
			||||||
PKG_REV:=909656ed7908c51b7f42844ba26e3a41ac7ab8bb
 | 
					PKG_REV:=f820d65e57098094231083c2e83ed4983d2be049
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 | 
					PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 | 
				
			||||||
PKG_SOURCE_URL:=git://github.com/wlanslovenija/tunneldigger.git
 | 
					PKG_SOURCE_URL:=git://github.com/ffrl/tunneldigger.git
 | 
				
			||||||
PKG_SOURCE_PROTO:=git
 | 
					PKG_SOURCE_PROTO:=git
 | 
				
			||||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 | 
					PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 | 
				
			||||||
PKG_SOURCE_VERSION:=$(PKG_REV)
 | 
					PKG_SOURCE_VERSION:=$(PKG_REV)
 | 
				
			||||||
 | 
				
			|||||||
@ -6,4 +6,5 @@ config broker
 | 
				
			|||||||
	option group 'root'
 | 
						option group 'root'
 | 
				
			||||||
	option interface 'l2tp0'
 | 
						option interface 'l2tp0'
 | 
				
			||||||
	option limit_bw_down '1024'
 | 
						option limit_bw_down '1024'
 | 
				
			||||||
 | 
						option broker_selection 'usage'
 | 
				
			||||||
	option enabled '0'
 | 
						option enabled '0'
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,7 @@ config_cb() {
 | 
				
			|||||||
			config_get limit_bw_down "$cfg" limit_bw_down
 | 
								config_get limit_bw_down "$cfg" limit_bw_down
 | 
				
			||||||
			config_get hook_script "$cfg" hook_script
 | 
								config_get hook_script "$cfg" hook_script
 | 
				
			||||||
			config_get bind_interface "$cfg" bind_interface
 | 
								config_get bind_interface "$cfg" bind_interface
 | 
				
			||||||
 | 
								config_get broker_selection "$cfg" broker_selection
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			[ $enabled -eq 0 ] && return
 | 
								[ $enabled -eq 0 ] && return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -40,6 +41,20 @@ config_cb() {
 | 
				
			|||||||
				network_get_device _bind_interface "${bind_interface}" || _bind_interface="${bind_interface}"
 | 
									network_get_device _bind_interface "${bind_interface}" || _bind_interface="${bind_interface}"
 | 
				
			||||||
				append broker_opts "-I ${_bind_interface}"
 | 
									append broker_opts "-I ${_bind_interface}"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								[ ! -z "${broker_selection}" ] && {
 | 
				
			||||||
 | 
									# Set broker selection.
 | 
				
			||||||
 | 
									case "${broker_selection}" in
 | 
				
			||||||
 | 
										usage)
 | 
				
			||||||
 | 
											append broker_opts "-a"
 | 
				
			||||||
 | 
										;;
 | 
				
			||||||
 | 
										first)
 | 
				
			||||||
 | 
											append broker_opts "-g"
 | 
				
			||||||
 | 
										;;
 | 
				
			||||||
 | 
										random)
 | 
				
			||||||
 | 
											append broker_opts "-r"
 | 
				
			||||||
 | 
										;;
 | 
				
			||||||
 | 
									esac
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if [ -z "$uuid" ]; then
 | 
								if [ -z "$uuid" ]; then
 | 
				
			||||||
				missing uuid
 | 
									missing uuid
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user