File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
use async_trait:: async_trait;
2
2
use digitalocean_rs:: DigitalOceanApi ;
3
3
use digitalocean_rs:: DigitalOceanError ;
4
+ use kube:: core:: ObjectMeta ;
4
5
use names:: Generator ;
5
6
use schemars:: JsonSchema ;
6
7
use serde:: { Deserialize , Serialize } ;
7
8
use std:: env;
8
9
10
+ use crate :: ops:: ExitNode ;
11
+
9
12
/// Simple wrapper for names crate
10
13
pub fn generate_name ( ) -> String {
11
14
let mut generator = Generator :: default ( ) ;
@@ -30,6 +33,27 @@ pub struct CloudExitNode {
30
33
pub ip : String ,
31
34
}
32
35
36
+ const CHISEL_PORT : u16 = 9090 ;
37
+
38
+ impl Into < ExitNode > for CloudExitNode {
39
+ fn into ( self ) -> ExitNode {
40
+ ExitNode {
41
+ spec : crate :: ops:: ExitNodeSpec {
42
+ host : self . ip . clone ( ) ,
43
+ external_host : Some ( self . ip . clone ( ) ) ,
44
+ port : CHISEL_PORT ,
45
+ fingerprint : None ,
46
+ auth : Some ( self . password ) ,
47
+ default_route : false ,
48
+ } ,
49
+ metadata : ObjectMeta {
50
+ name : Some ( self . name ) ,
51
+ ..ObjectMeta :: default ( )
52
+ } ,
53
+ }
54
+ }
55
+ }
56
+
33
57
#[ async_trait]
34
58
pub trait Provisioner {
35
59
async fn create_exit_node ( & self ) -> color_eyre:: Result < CloudExitNode > ;
You can’t perform that action at this time.
0 commit comments