set dependencies version and include bindgen in build script to create c bindgens
This commit is contained in:
		
							parent
							
								
									e22e4587a4
								
							
						
					
					
						commit
						2587556288
					
				
							
								
								
									
										345
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										345
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -4,18 +4,18 @@ version = 3 | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "addr2line" | name = "addr2line" | ||||||
| version = "0.22.0" | version = "0.24.2" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" | checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "gimli", |  "gimli", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "adler" | name = "adler2" | ||||||
| version = "1.0.2" | version = "2.0.0" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "aho-corasick" | name = "aho-corasick" | ||||||
| @ -28,9 +28,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "anstream" | name = "anstream" | ||||||
| version = "0.6.15" | version = "0.6.18" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" | checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "anstyle", |  "anstyle", | ||||||
|  "anstyle-parse", |  "anstyle-parse", | ||||||
| @ -43,63 +43,63 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "anstyle" | name = "anstyle" | ||||||
| version = "1.0.8" | version = "1.0.10" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" | checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "anstyle-parse" | name = "anstyle-parse" | ||||||
| version = "0.2.5" | version = "0.2.6" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" | checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "utf8parse", |  "utf8parse", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "anstyle-query" | name = "anstyle-query" | ||||||
| version = "1.1.1" | version = "1.1.2" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" | checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "windows-sys", |  "windows-sys 0.59.0", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "anstyle-wincon" | name = "anstyle-wincon" | ||||||
| version = "3.0.4" | version = "3.0.6" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" | checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "anstyle", |  "anstyle", | ||||||
|  "windows-sys", |  "windows-sys 0.59.0", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "anyhow" | name = "anyhow" | ||||||
| version = "1.0.86" | version = "1.0.93" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" | checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "autocfg" | name = "autocfg" | ||||||
| version = "1.3.0" | version = "1.4.0" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "backtrace" | name = "backtrace" | ||||||
| version = "0.3.73" | version = "0.3.74" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" | checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "addr2line", |  "addr2line", | ||||||
|  "cc", |  | ||||||
|  "cfg-if", |  "cfg-if", | ||||||
|  "libc", |  "libc", | ||||||
|  "miniz_oxide", |  "miniz_oxide", | ||||||
|  "object", |  "object", | ||||||
|  "rustc-demangle", |  "rustc-demangle", | ||||||
|  |  "windows-targets", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| @ -142,15 +142,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "bytes" | name = "bytes" | ||||||
| version = "1.7.1" | version = "1.8.0" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" | checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "cc" | name = "cc" | ||||||
| version = "1.1.14" | version = "1.1.37" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" | checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "shlex", |  "shlex", | ||||||
| ] | ] | ||||||
| @ -170,6 +170,12 @@ version = "1.0.0" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "cfg_aliases" | ||||||
|  | version = "0.2.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "clang-sys" | name = "clang-sys" | ||||||
| version = "1.8.1" | version = "1.8.1" | ||||||
| @ -183,9 +189,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "colorchoice" | name = "colorchoice" | ||||||
| version = "1.0.2" | version = "1.0.3" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" | checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "either" | name = "either" | ||||||
| @ -217,10 +223,16 @@ dependencies = [ | |||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures" | name = "equivalent" | ||||||
| version = "0.3.30" | version = "1.0.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "futures" | ||||||
|  | version = "0.3.31" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "futures-channel", |  "futures-channel", | ||||||
|  "futures-core", |  "futures-core", | ||||||
| @ -233,9 +245,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-channel" | name = "futures-channel" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" | checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "futures-core", |  "futures-core", | ||||||
|  "futures-sink", |  "futures-sink", | ||||||
| @ -243,15 +255,15 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-core" | name = "futures-core" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" | checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-executor" | name = "futures-executor" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" | checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "futures-core", |  "futures-core", | ||||||
|  "futures-task", |  "futures-task", | ||||||
| @ -260,15 +272,15 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-io" | name = "futures-io" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" | checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-macro" | name = "futures-macro" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" | checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "proc-macro2", |  "proc-macro2", | ||||||
|  "quote", |  "quote", | ||||||
| @ -277,21 +289,21 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-sink" | name = "futures-sink" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" | checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-task" | name = "futures-task" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" | checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "futures-util" | name = "futures-util" | ||||||
| version = "0.3.30" | version = "0.3.31" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" | checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "futures-channel", |  "futures-channel", | ||||||
|  "futures-core", |  "futures-core", | ||||||
| @ -307,9 +319,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "gimli" | name = "gimli" | ||||||
| version = "0.29.0" | version = "0.31.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" | checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "glob" | name = "glob" | ||||||
| @ -317,6 +329,12 @@ version = "0.3.1" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "hashbrown" | ||||||
|  | version = "0.15.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "hermit-abi" | name = "hermit-abi" | ||||||
| version = "0.3.9" | version = "0.3.9" | ||||||
| @ -329,6 +347,16 @@ version = "2.1.0" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "indexmap" | ||||||
|  | version = "2.6.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" | ||||||
|  | dependencies = [ | ||||||
|  |  "equivalent", | ||||||
|  |  "hashbrown", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "is_terminal_polyfill" | name = "is_terminal_polyfill" | ||||||
| version = "1.70.1" | version = "1.70.1" | ||||||
| @ -345,10 +373,16 @@ dependencies = [ | |||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "libc" | name = "itoa" | ||||||
| version = "0.2.158" | version = "1.0.11" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "libc" | ||||||
|  | version = "0.2.162" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "libloading" | name = "libloading" | ||||||
| @ -360,16 +394,6 @@ dependencies = [ | |||||||
|  "windows-targets", |  "windows-targets", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "lock_api" |  | ||||||
| version = "0.4.12" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" |  | ||||||
| dependencies = [ |  | ||||||
|  "autocfg", |  | ||||||
|  "scopeguard", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "log" | name = "log" | ||||||
| version = "0.4.22" | version = "0.4.22" | ||||||
| @ -390,11 +414,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "miniz_oxide" | name = "miniz_oxide" | ||||||
| version = "0.7.4" | version = "0.8.0" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" | checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "adler", |  "adler2", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| @ -406,7 +430,7 @@ dependencies = [ | |||||||
|  "hermit-abi", |  "hermit-abi", | ||||||
|  "libc", |  "libc", | ||||||
|  "wasi", |  "wasi", | ||||||
|  "windows-sys", |  "windows-sys 0.52.0", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| @ -420,8 +444,10 @@ dependencies = [ | |||||||
|  "futures", |  "futures", | ||||||
|  "log", |  "log", | ||||||
|  "netlink-packet-route", |  "netlink-packet-route", | ||||||
|  "nix", |  "nix 0.29.0", | ||||||
|  "rtnetlink", |  "rtnetlink", | ||||||
|  |  "serde", | ||||||
|  |  "serde_yaml", | ||||||
|  "tokio", |  "tokio", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| @ -501,6 +527,18 @@ dependencies = [ | |||||||
|  "libc", |  "libc", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "nix" | ||||||
|  | version = "0.29.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" | ||||||
|  | dependencies = [ | ||||||
|  |  "bitflags", | ||||||
|  |  "cfg-if", | ||||||
|  |  "cfg_aliases", | ||||||
|  |  "libc", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "nom" | name = "nom" | ||||||
| version = "7.1.3" | version = "7.1.3" | ||||||
| @ -513,36 +551,13 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "object" | name = "object" | ||||||
| version = "0.36.3" | version = "0.36.5" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" | checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "memchr", |  "memchr", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "parking_lot" |  | ||||||
| version = "0.12.3" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" |  | ||||||
| dependencies = [ |  | ||||||
|  "lock_api", |  | ||||||
|  "parking_lot_core", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] |  | ||||||
| name = "parking_lot_core" |  | ||||||
| version = "0.9.10" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" |  | ||||||
| dependencies = [ |  | ||||||
|  "cfg-if", |  | ||||||
|  "libc", |  | ||||||
|  "redox_syscall", |  | ||||||
|  "smallvec", |  | ||||||
|  "windows-targets", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "paste" | name = "paste" | ||||||
| version = "1.0.15" | version = "1.0.15" | ||||||
| @ -551,9 +566,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "pin-project-lite" | name = "pin-project-lite" | ||||||
| version = "0.2.14" | version = "0.2.15" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" | checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "pin-utils" | name = "pin-utils" | ||||||
| @ -563,9 +578,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "prettyplease" | name = "prettyplease" | ||||||
| version = "0.2.22" | version = "0.2.25" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" | checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "proc-macro2", |  "proc-macro2", | ||||||
|  "syn", |  "syn", | ||||||
| @ -573,9 +588,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "proc-macro2" | name = "proc-macro2" | ||||||
| version = "1.0.86" | version = "1.0.89" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" | checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "unicode-ident", |  "unicode-ident", | ||||||
| ] | ] | ||||||
| @ -589,20 +604,11 @@ dependencies = [ | |||||||
|  "proc-macro2", |  "proc-macro2", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "redox_syscall" |  | ||||||
| version = "0.5.3" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" |  | ||||||
| dependencies = [ |  | ||||||
|  "bitflags", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "regex" | name = "regex" | ||||||
| version = "1.10.6" | version = "1.11.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" | checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "aho-corasick", |  "aho-corasick", | ||||||
|  "memchr", |  "memchr", | ||||||
| @ -612,9 +618,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "regex-automata" | name = "regex-automata" | ||||||
| version = "0.4.7" | version = "0.4.8" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" | checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "aho-corasick", |  "aho-corasick", | ||||||
|  "memchr", |  "memchr", | ||||||
| @ -623,9 +629,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "regex-syntax" | name = "regex-syntax" | ||||||
| version = "0.8.4" | version = "0.8.5" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" | checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "rtnetlink" | name = "rtnetlink" | ||||||
| @ -640,7 +646,7 @@ dependencies = [ | |||||||
|  "netlink-packet-utils", |  "netlink-packet-utils", | ||||||
|  "netlink-proto", |  "netlink-proto", | ||||||
|  "netlink-sys", |  "netlink-sys", | ||||||
|  "nix", |  "nix 0.27.1", | ||||||
|  "thiserror", |  "thiserror", | ||||||
|  "tokio", |  "tokio", | ||||||
| ] | ] | ||||||
| @ -658,10 +664,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||||||
| checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "scopeguard" | name = "ryu" | ||||||
| version = "1.2.0" | version = "1.0.18" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "serde" | ||||||
|  | version = "1.0.214" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" | ||||||
|  | dependencies = [ | ||||||
|  |  "serde_derive", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "serde_derive" | ||||||
|  | version = "1.0.214" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" | ||||||
|  | dependencies = [ | ||||||
|  |  "proc-macro2", | ||||||
|  |  "quote", | ||||||
|  |  "syn", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "serde_yaml" | ||||||
|  | version = "0.9.34+deprecated" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" | ||||||
|  | dependencies = [ | ||||||
|  |  "indexmap", | ||||||
|  |  "itoa", | ||||||
|  |  "ryu", | ||||||
|  |  "serde", | ||||||
|  |  "unsafe-libyaml", | ||||||
|  | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "shlex" | name = "shlex" | ||||||
| @ -669,15 +708,6 @@ version = "1.3.0" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "signal-hook-registry" |  | ||||||
| version = "1.4.2" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" |  | ||||||
| dependencies = [ |  | ||||||
|  "libc", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "slab" | name = "slab" | ||||||
| version = "0.4.9" | version = "0.4.9" | ||||||
| @ -687,12 +717,6 @@ dependencies = [ | |||||||
|  "autocfg", |  "autocfg", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] |  | ||||||
| name = "smallvec" |  | ||||||
| version = "1.13.2" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" |  | ||||||
| 
 |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "socket2" | name = "socket2" | ||||||
| version = "0.5.7" | version = "0.5.7" | ||||||
| @ -700,14 +724,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||||||
| checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" | checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "libc", |  "libc", | ||||||
|  "windows-sys", |  "windows-sys 0.52.0", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "syn" | name = "syn" | ||||||
| version = "2.0.76" | version = "2.0.87" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" | checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "proc-macro2", |  "proc-macro2", | ||||||
|  "quote", |  "quote", | ||||||
| @ -716,18 +740,18 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "thiserror" | name = "thiserror" | ||||||
| version = "1.0.63" | version = "1.0.68" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" | checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "thiserror-impl", |  "thiserror-impl", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "thiserror-impl" | name = "thiserror-impl" | ||||||
| version = "1.0.63" | version = "1.0.68" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" | checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "proc-macro2", |  "proc-macro2", | ||||||
|  "quote", |  "quote", | ||||||
| @ -736,38 +760,30 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "tokio" | name = "tokio" | ||||||
| version = "1.39.3" | version = "1.41.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" | checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "backtrace", |  "backtrace", | ||||||
|  "bytes", |  "bytes", | ||||||
|  "libc", |  "libc", | ||||||
|  "mio", |  "mio", | ||||||
|  "parking_lot", |  | ||||||
|  "pin-project-lite", |  "pin-project-lite", | ||||||
|  "signal-hook-registry", |  | ||||||
|  "socket2", |  "socket2", | ||||||
|  "tokio-macros", |  "windows-sys 0.52.0", | ||||||
|  "windows-sys", |  | ||||||
| ] |  | ||||||
| 
 |  | ||||||
| [[package]] |  | ||||||
| name = "tokio-macros" |  | ||||||
| version = "2.4.0" |  | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" |  | ||||||
| checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" |  | ||||||
| dependencies = [ |  | ||||||
|  "proc-macro2", |  | ||||||
|  "quote", |  | ||||||
|  "syn", |  | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "unicode-ident" | name = "unicode-ident" | ||||||
| version = "1.0.12" | version = "1.0.13" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" | checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "unsafe-libyaml" | ||||||
|  | version = "0.2.11" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "utf8parse" | name = "utf8parse" | ||||||
| @ -790,6 +806,15 @@ dependencies = [ | |||||||
|  "windows-targets", |  "windows-targets", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "windows-sys" | ||||||
|  | version = "0.59.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" | ||||||
|  | dependencies = [ | ||||||
|  |  "windows-targets", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "windows-targets" | name = "windows-targets" | ||||||
| version = "0.52.6" | version = "0.52.6" | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								Cargo.toml
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Cargo.toml
									
									
									
									
									
								
							| @ -4,14 +4,16 @@ version = "0.1.0" | |||||||
| edition = "2021" | edition = "2021" | ||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| nix = {version = '*', features= ["fs", "mount", "sched"] } | nix = {version = '0.29', features= ["fs", "mount", "sched"] } | ||||||
| rtnetlink = {version = '*', features = ["tokio_socket"] } | rtnetlink = {version = '0.14', features = ["tokio_socket"] } | ||||||
| netlink-packet-route = '*' | netlink-packet-route = '0.19' | ||||||
| futures = '*' | futures = '0.3' | ||||||
| log = '*' | log = '0.4' | ||||||
| env_logger = '*' | env_logger = '0.11' | ||||||
| tokio = {version = '*', features = ["full"] } | tokio = {version = '1', features = ["rt-multi-thread"] } | ||||||
| base64 = '*' | base64 = '0.22' | ||||||
|  | serde = { version = "1", features = ["derive"] } | ||||||
|  | serde_yaml = "0.9" | ||||||
| 
 | 
 | ||||||
| [build-dependencies] | [build-dependencies] | ||||||
| cc = "1" | cc = "1" | ||||||
|  | |||||||
							
								
								
									
										23
									
								
								build.rs
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								build.rs
									
									
									
									
									
								
							| @ -1,4 +1,3 @@ | |||||||
| 
 |  | ||||||
| fn main() { | fn main() { | ||||||
|     cc::Build::new() |     cc::Build::new() | ||||||
|         .file("src/wireguard_manager/wireguard_wrapper.c") |         .file("src/wireguard_manager/wireguard_wrapper.c") | ||||||
| @ -9,4 +8,26 @@ fn main() { | |||||||
|         .compile("wireguard.a"); |         .compile("wireguard.a"); | ||||||
| 
 | 
 | ||||||
|     println!("cargo::rerun-if-changed=src/wireguard.c"); |     println!("cargo::rerun-if-changed=src/wireguard.c"); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // The bindgen::Builder is the main entry point
 | ||||||
|  |     // to bindgen, and lets you build up options for
 | ||||||
|  |     // the resulting bindings.
 | ||||||
|  |     let bindings = bindgen::Builder::default() | ||||||
|  |         // The input header we would like to generate
 | ||||||
|  |         // bindings for.
 | ||||||
|  |         .header("src/wireguard_manager/wireguard_wrapper.h") | ||||||
|  |         // Tell cargo to invalidate the built crate whenever any of the
 | ||||||
|  |         // included header files changed.
 | ||||||
|  |         .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) | ||||||
|  |         // Finish the builder and generate the bindings.
 | ||||||
|  |         .generate() | ||||||
|  |         // Unwrap the Result and panic on failure.
 | ||||||
|  |         .expect("Unable to generate bindings"); | ||||||
|  | 
 | ||||||
|  |     // Write the bindings to the $OUT_DIR/bindings.rs file.
 | ||||||
|  |     //let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
 | ||||||
|  |     bindings | ||||||
|  |         .write_to_file("src/wireguard_manager/wireguard_wrapper.rs") | ||||||
|  |         .expect("Couldn't write bindings!"); | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,6 +1,4 @@ | |||||||
| use rtnetlink::{new_connection, Error, Handle}; | use rtnetlink::{new_connection, Error}; | ||||||
| use netlink_packet_route::link::LinkMessage; |  | ||||||
| use std::net::IpAddr; |  | ||||||
| use std::os::fd::AsRawFd; | use std::os::fd::AsRawFd; | ||||||
| use futures::TryStreamExt; | use futures::TryStreamExt; | ||||||
| mod netlink; | mod netlink; | ||||||
| @ -29,7 +27,6 @@ pub fn configure_wireguard_interface( | |||||||
|     tokio::runtime::Runtime::new().unwrap().handle().block_on( async { |     tokio::runtime::Runtime::new().unwrap().handle().block_on( async { | ||||||
|         let (connection, handle, _) = new_connection().unwrap(); |         let (connection, handle, _) = new_connection().unwrap(); | ||||||
|         tokio::spawn(connection); |         tokio::spawn(connection); | ||||||
|         //netlink::create_wireguard_interface(handle.clone(), interface_name.clone()).await?;
 |  | ||||||
|         let link = netlink::get_link_interface(handle.clone(), interface_name.clone()).await?; |         let link = netlink::get_link_interface(handle.clone(), interface_name.clone()).await?; | ||||||
|         netlink::assign_ip(handle.clone(), link.clone(), interface_ip, prefix).await?; |         netlink::assign_ip(handle.clone(), link.clone(), interface_ip, prefix).await?; | ||||||
|         crate::wireguard_manager::add_properties::set_params(wg_pub_key, wg_priv_key, peer_ip, interface_name.clone()); |         crate::wireguard_manager::add_properties::set_params(wg_pub_key, wg_priv_key, peer_ip, interface_name.clone()); | ||||||
| @ -48,51 +45,6 @@ pub fn set_interface_lo_up() -> Result<(), Error> { | |||||||
|     }) |     }) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*pub fn set_interface_up(interface: String) -> Result<(), Error> {
 |  | ||||||
|     tokio::runtime::Runtime::new().unwrap().handle().block_on( async { |  | ||||||
|         let (connection, handle, _) = new_connection().unwrap(); |  | ||||||
|         tokio::spawn(connection); |  | ||||||
|         let mut links = handle.link().get().match_name(interface).execute(); |  | ||||||
|         if let Some(link) = links.try_next().await.unwrap() { |  | ||||||
|         let index = link.header.index; |  | ||||||
|         log::debug!("index:{}", index); |  | ||||||
|         handle |  | ||||||
|             .link() |  | ||||||
|             .set(index) |  | ||||||
|             .up() |  | ||||||
|             .execute() |  | ||||||
|             .await.unwrap() |  | ||||||
|     } else { |  | ||||||
|         log::debug!("no link link lo found"); |  | ||||||
|     } |  | ||||||
|     }); |  | ||||||
|     Ok(()) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| pub fn create_wireguard_interface(interface: String) -> Result<(), Error> { |  | ||||||
|     tokio::runtime::Runtime::new().unwrap().handle().block_on( async { |  | ||||||
|         let (connection, handle, _) = new_connection().unwrap(); |  | ||||||
|         tokio::spawn(connection); |  | ||||||
|         handle.link().add().wireguard(interface).execute().await.unwrap(); |  | ||||||
|     }); |  | ||||||
|     Ok(()) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| pub async fn assign_ip(handle: Handle, link: LinkMessage, interface: String, ip: String, prefix: u8) -> Result<(), Error> { |  | ||||||
|     let usable_ip: IpAddr = match ip.parse() { |  | ||||||
|         Ok(ip_ok) => ip_ok, |  | ||||||
|         Err(_e) => { |  | ||||||
|             log::debug!("malformed ip"); |  | ||||||
|             return Err(Error::InvalidIp(ip.into_bytes())); |  | ||||||
|         }, |  | ||||||
|     }; |  | ||||||
|     handle |  | ||||||
|         .address() |  | ||||||
|         .add(link.header.index, usable_ip, prefix) |  | ||||||
|         .execute() |  | ||||||
|         .await |  | ||||||
| }*/ |  | ||||||
| 
 |  | ||||||
| pub fn get_inferfaces() -> Result<(), Error> { | pub fn get_inferfaces() -> Result<(), Error> { | ||||||
|         tokio::runtime::Runtime::new().unwrap().handle().block_on( async { |         tokio::runtime::Runtime::new().unwrap().handle().block_on( async { | ||||||
|         let (connection, handle, _) = new_connection().unwrap(); |         let (connection, handle, _) = new_connection().unwrap(); | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| use rtnetlink::{new_connection, Error, Handle}; | use rtnetlink::{Error, Handle}; | ||||||
| use netlink_packet_route::link::LinkMessage; | use netlink_packet_route::link::LinkMessage; | ||||||
| use std::net::IpAddr; | use std::net::IpAddr; | ||||||
| use futures::TryStreamExt; | use futures::TryStreamExt; | ||||||
|  | |||||||
| @ -1,139 +0,0 @@ | |||||||
| use nix::sched::{CloneFlags, clone, unshare, setns}; |  | ||||||
| use nix::sys::signal::Signal; |  | ||||||
| use crate::namespace::consts::{ |  | ||||||
|     NET_NS_DIR, |  | ||||||
|     STACK_SIZE |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| use futures::TryStreamExt; |  | ||||||
| use nix::fcntl::{open, OFlag}; |  | ||||||
| use nix::mount::{mount, MsFlags}; |  | ||||||
| use nix::unistd::{fork, ForkResult, Pid}; |  | ||||||
| use nix::sys::wait::{waitpid, WaitStatus}; |  | ||||||
| use nix::sys::stat::Mode; |  | ||||||
| use nix::sys::statvfs::{statvfs, FsFlags}; |  | ||||||
| use rtnetlink::{new_connection, Error, Handle, NetworkNamespace}; |  | ||||||
| 
 |  | ||||||
| use std::env; |  | ||||||
| use std::fs::{File, OpenOptions}; |  | ||||||
| use std::path::{Path, PathBuf}; |  | ||||||
| use std::process::exit; |  | ||||||
| use std::os::unix::io::RawFd; |  | ||||||
| use std::os::fd::FromRawFd; |  | ||||||
| 
 |  | ||||||
| pub fn run_in_namespace<F>(f: F,ns_name: &String) -> Result<(), ()> where F:FnMut() + Copy { |  | ||||||
|     // Configure networking in the child namespace:
 |  | ||||||
|     // Fork a process that is set to the newly created namespace
 |  | ||||||
|     // Here set the veth ip addr, routing tables etc.
 |  | ||||||
|     // Unfortunately the NetworkNamespace interface of rtnetlink does
 |  | ||||||
|     // not offer these functionalities
 |  | ||||||
|     let mut tmp_stack: [u8; STACK_SIZE] = [0; STACK_SIZE]; |  | ||||||
|     let mut flags = CloneFlags::empty(); |  | ||||||
|     flags.insert(CloneFlags::CLONE_VM); |  | ||||||
|     flags.insert(CloneFlags::CLONE_VFORK); |  | ||||||
| 
 |  | ||||||
|     unsafe { |  | ||||||
|         match clone( |  | ||||||
|             Box::new(|| run_child(f,&ns_name.clone())), |  | ||||||
|             &mut tmp_stack, |  | ||||||
|             flags, |  | ||||||
|             Some(Signal::SIGCHLD as i32)) { |  | ||||||
|                 Ok(_pid) => Ok(()), |  | ||||||
|                 Err(_e) => { |  | ||||||
|                     return Err(()); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| fn run_child<F>(mut f: F, ns_name: &String) -> isize where F:FnMut() { |  | ||||||
|     let res = prepare_namespace(ns_name); |  | ||||||
| 
 |  | ||||||
|     match res { |  | ||||||
|         Err(_) => { |  | ||||||
|             log::error!("Child process crashed"); |  | ||||||
|             return -1; |  | ||||||
|         } |  | ||||||
|         Ok(()) => { |  | ||||||
|             log::debug!("Child exited normally"); |  | ||||||
|             f(); |  | ||||||
|             return 0; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| fn prepare_namespace(ns_name: &String) -> Result<(), ()> { |  | ||||||
|     // First create the network namespace
 |  | ||||||
|     // NetworkNamespace::add(ns_name.to_string()).await.map_err(|e| {
 |  | ||||||
|     //     log::error!("Can not create namespace {}", e);
 |  | ||||||
|     // }).unwrap();
 |  | ||||||
| 
 |  | ||||||
|     // Open NS path
 |  | ||||||
|     let ns_path = format!("{}/{}", NET_NS_DIR, ns_name); |  | ||||||
|     log::debug!("ns_path:{}", ns_path); |  | ||||||
|     let mut open_flags = OFlag::empty(); |  | ||||||
|     open_flags.insert(OFlag::O_RDONLY); |  | ||||||
|     open_flags.insert(OFlag::O_CLOEXEC); |  | ||||||
| 
 |  | ||||||
|     let fd = match open(Path::new(&ns_path), open_flags, Mode::empty()) { |  | ||||||
|         Ok(raw_fd) => unsafe { |  | ||||||
|             File::from_raw_fd(raw_fd) |  | ||||||
|         } |  | ||||||
|         Err(e) => { |  | ||||||
|             log::error!("Can not open network namespace: {}", e); |  | ||||||
|             return Err(()); |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
|     // Switch to network namespace with CLONE_NEWNET
 |  | ||||||
|     if let Err(e) = setns(fd, CloneFlags::CLONE_NEWNET) { |  | ||||||
|         log::error!("Can not set namespace to target {}: {}", ns_name, e); |  | ||||||
|         return Err(()); |  | ||||||
|     } |  | ||||||
|     // unshare with CLONE_NEWNS
 |  | ||||||
|     if let Err(e) = unshare(CloneFlags::CLONE_NEWNS) { |  | ||||||
|         log::error!("Can not unshare: {}", e); |  | ||||||
|         return Err(()); |  | ||||||
|     } |  | ||||||
|     // mount blind the fs
 |  | ||||||
|     // let's avoid that any mount propagates to the parent process
 |  | ||||||
|     // mount_directory(None, &PathBuf::from("/"), vec![MsFlags::MS_REC, MsFlags::MS_PRIVATE])?;
 |  | ||||||
|     let mut mount_flags = MsFlags::empty(); |  | ||||||
|     mount_flags.insert(MsFlags::MS_REC); |  | ||||||
|     mount_flags.insert(MsFlags::MS_PRIVATE); |  | ||||||
|     if let Err(_e) = mount::<PathBuf, PathBuf, str, PathBuf>(None, &PathBuf::from("/"), None, mount_flags, None) { |  | ||||||
|         log::error!("Can not remount root directory"); |  | ||||||
|         () |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     // Now unmount /sys
 |  | ||||||
|     let sys_path = PathBuf::from("/sys"); |  | ||||||
|     mount_flags = MsFlags::empty(); |  | ||||||
|     // Needed to respect the trait for NixPath
 |  | ||||||
|     let ns_name_path = PathBuf::from(ns_name); |  | ||||||
| 
 |  | ||||||
|     // TODO do not exit for EINVAL error
 |  | ||||||
|     // unmount_path(&sys_path)?;
 |  | ||||||
|     // consider the case that a sysfs is not present
 |  | ||||||
|     let stat_sys = match statvfs(&sys_path) |  | ||||||
|         .map_err(|e| { |  | ||||||
|             log::error!("Can not stat sys: {}", e); |  | ||||||
|     }){ |  | ||||||
|         Ok(stat) => stat, |  | ||||||
|         Err(_e) => { |  | ||||||
|             log::error!("Error in stat sys"); |  | ||||||
|             return Err(()); |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
|     if stat_sys.flags().contains(FsFlags::ST_RDONLY) { |  | ||||||
|         mount_flags.insert(MsFlags::MS_RDONLY); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     // and remount a version of /sys that describes the network namespace
 |  | ||||||
|     if let Err(e) = mount::<PathBuf, PathBuf, str, PathBuf>(Some(&ns_name_path), &sys_path, Some("sysfs"), mount_flags, None) { |  | ||||||
|         log::error!("Can not remount /sys to namespace: {}", e); |  | ||||||
|         () |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     Ok(()) |  | ||||||
| } |  | ||||||
| @ -1,3 +1 @@ | |||||||
| pub const NET_NS_DIR:&str = "/var/run/netns"; | pub const NET_NS_DIR:&str = "/var/run/netns"; | ||||||
| pub const PROC_NS_DIR:&str = "/proc/self/ns/net"; |  | ||||||
| pub const STACK_SIZE: usize = 1024 * 1024; |  | ||||||
|  | |||||||
| @ -7,11 +7,10 @@ use nix::unistd::{fork, ForkResult, Pid}; | |||||||
| use nix::sys::wait::{waitpid, WaitStatus}; | use nix::sys::wait::{waitpid, WaitStatus}; | ||||||
| use nix::sys::stat::Mode; | use nix::sys::stat::Mode; | ||||||
| use nix::sys::statvfs::{statvfs, FsFlags}; | use nix::sys::statvfs::{statvfs, FsFlags}; | ||||||
| use std::os::unix::io::RawFd; |  | ||||||
| 
 | 
 | ||||||
| use std::path::{Path, PathBuf}; | use std::path::{Path, PathBuf}; | ||||||
| use std::process::exit; | use std::process::exit; | ||||||
| use std::fs::{File, OpenOptions}; | use std::fs::File; | ||||||
| use std::os::fd::FromRawFd; | use std::os::fd::FromRawFd; | ||||||
| 
 | 
 | ||||||
| pub fn run_in_namespace<F>(f: F,ns_name: &String) -> Result<(), ()> where F:FnMut() + Copy { | pub fn run_in_namespace<F>(f: F,ns_name: &String) -> Result<(), ()> where F:FnMut() + Copy { | ||||||
| @ -53,7 +52,7 @@ fn run_parent(child: Pid) -> Result<(), ()> { | |||||||
|                     return Err(()); |                     return Err(()); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             WaitStatus::Signaled(_, signal, coredump) => { |             WaitStatus::Signaled(_, _signal, _coredump) => { | ||||||
|                 log::error!("Child process killed by signal"); |                 log::error!("Child process killed by signal"); | ||||||
|                 return Err(()); |                 return Err(()); | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -1,3 +1,2 @@ | |||||||
| pub mod create_ns; | pub mod create_ns; | ||||||
| pub mod bind_interface; |  | ||||||
| mod consts; | mod consts; | ||||||
|  | |||||||
| @ -28,18 +28,10 @@ pub fn set_params(mut wg_pub_key: [u8; 32], | |||||||
|                                                                 CString::new(interface_name).unwrap().into_raw(), |                                                                 CString::new(interface_name).unwrap().into_raw(), | ||||||
|                                                                 51820, peer); |                                                                 51820, peer); | ||||||
| 
 | 
 | ||||||
|         //let status_add_device = wireguard_wrapper::wg_add_device(device.name.as_ptr());
 |  | ||||||
|         let status_set_device = wireguard_wrapper::wg_set_device(&mut device); |         let status_set_device = wireguard_wrapper::wg_set_device(&mut device); | ||||||
|         //println!("dispositivo: {}", CString::from_raw(device.name.as_mut_ptr()).to_str().unwrap());
 |  | ||||||
|         /*if ret {
 |  | ||||||
|             println!("añade el dispositivo"); |  | ||||||
|             //println!("dispositivo: {}", CString::from_raw(device.name.as_mut_ptr()).to_str().unwrap());
 |  | ||||||
|             ret = ret && (wireguard_wrapper::wg_set_device(&mut device) < 0); |  | ||||||
|         }*/ |  | ||||||
|         //ret = status_add_device >= 0 && status_set_device >= 0;
 |  | ||||||
|         ret = status_set_device >= 0; |         ret = status_set_device >= 0; | ||||||
|         log::debug!("Status: {}", ret); |  | ||||||
|         wireguard_wrapper::clean_device(&mut peer); |         wireguard_wrapper::clean_device(&mut peer); | ||||||
|     } |     } | ||||||
|     ret |     ret | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -1,2 +1,3 @@ | |||||||
|  | #[allow(warnings)] | ||||||
| mod wireguard_wrapper; | mod wireguard_wrapper; | ||||||
| pub mod add_properties; | pub mod add_properties; | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,5 +1,4 @@ | |||||||
| /* automatically generated by rust-bindgen 0.70.1 */ | /* automatically generated by rust-bindgen 0.70.1 */ | ||||||
| #![allow(warnings)] |  | ||||||
| 
 | 
 | ||||||
| #[repr(C)] | #[repr(C)] | ||||||
| #[derive(Default)] | #[derive(Default)] | ||||||
| @ -41,7 +40,7 @@ pub const __STDC_ISO_10646__: u32 = 201706; | |||||||
| pub const _NET_IF_H: u32 = 1; | pub const _NET_IF_H: u32 = 1; | ||||||
| pub const _FEATURES_H: u32 = 1; | pub const _FEATURES_H: u32 = 1; | ||||||
| pub const _DEFAULT_SOURCE: u32 = 1; | pub const _DEFAULT_SOURCE: u32 = 1; | ||||||
| pub const __GLIBC_USE_ISOC2X: u32 = 0; | pub const __GLIBC_USE_ISOC23: u32 = 0; | ||||||
| pub const __USE_ISOC11: u32 = 1; | pub const __USE_ISOC11: u32 = 1; | ||||||
| pub const __USE_ISOC99: u32 = 1; | pub const __USE_ISOC99: u32 = 1; | ||||||
| pub const __USE_ISOC95: u32 = 1; | pub const __USE_ISOC95: u32 = 1; | ||||||
| @ -59,15 +58,16 @@ pub const __WORDSIZE: u32 = 64; | |||||||
| pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; | pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; | ||||||
| pub const __SYSCALL_WORDSIZE: u32 = 64; | pub const __SYSCALL_WORDSIZE: u32 = 64; | ||||||
| pub const __TIMESIZE: u32 = 64; | pub const __TIMESIZE: u32 = 64; | ||||||
|  | pub const __USE_TIME_BITS64: u32 = 1; | ||||||
| pub const __USE_MISC: u32 = 1; | pub const __USE_MISC: u32 = 1; | ||||||
| pub const __USE_ATFILE: u32 = 1; | pub const __USE_ATFILE: u32 = 1; | ||||||
| pub const __USE_FORTIFY_LEVEL: u32 = 0; | pub const __USE_FORTIFY_LEVEL: u32 = 0; | ||||||
| pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; | pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; | ||||||
| pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; | pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; | ||||||
| pub const __GLIBC_USE_C2X_STRTOL: u32 = 0; | pub const __GLIBC_USE_C23_STRTOL: u32 = 0; | ||||||
| pub const __GNU_LIBRARY__: u32 = 6; | pub const __GNU_LIBRARY__: u32 = 6; | ||||||
| pub const __GLIBC__: u32 = 2; | pub const __GLIBC__: u32 = 2; | ||||||
| pub const __GLIBC_MINOR__: u32 = 39; | pub const __GLIBC_MINOR__: u32 = 40; | ||||||
| pub const _SYS_CDEFS_H: u32 = 1; | pub const _SYS_CDEFS_H: u32 = 1; | ||||||
| pub const __glibc_c99_flexarr_available: u32 = 1; | pub const __glibc_c99_flexarr_available: u32 = 1; | ||||||
| pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; | pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; | ||||||
| @ -251,6 +251,7 @@ pub const SOL_XDP: u32 = 283; | |||||||
| pub const SOL_MPTCP: u32 = 284; | pub const SOL_MPTCP: u32 = 284; | ||||||
| pub const SOL_MCTP: u32 = 285; | pub const SOL_MCTP: u32 = 285; | ||||||
| pub const SOL_SMC: u32 = 286; | pub const SOL_SMC: u32 = 286; | ||||||
|  | pub const SOL_VSOCK: u32 = 287; | ||||||
| pub const SOMAXCONN: u32 = 4096; | pub const SOMAXCONN: u32 = 4096; | ||||||
| pub const _BITS_SOCKADDR_H: u32 = 1; | pub const _BITS_SOCKADDR_H: u32 = 1; | ||||||
| pub const _SS_SIZE: u32 = 128; | pub const _SS_SIZE: u32 = 128; | ||||||
| @ -526,10 +527,10 @@ pub const TIME_UTC: u32 = 1; | |||||||
| pub const _STDINT_H: u32 = 1; | pub const _STDINT_H: u32 = 1; | ||||||
| pub const __GLIBC_USE_LIB_EXT2: u32 = 0; | pub const __GLIBC_USE_LIB_EXT2: u32 = 0; | ||||||
| pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; | pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; | ||||||
| pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; | pub const __GLIBC_USE_IEC_60559_BFP_EXT_C23: u32 = 0; | ||||||
| pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0; | pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0; | ||||||
| pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; | pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; | ||||||
| pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; | pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C23: u32 = 0; | ||||||
| pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; | pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; | ||||||
| pub const _BITS_WCHAR_H: u32 = 1; | pub const _BITS_WCHAR_H: u32 = 1; | ||||||
| pub const _BITS_STDINT_LEAST_H: u32 = 1; | pub const _BITS_STDINT_LEAST_H: u32 = 1; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user