File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,42 @@ func (c *Control) ListHostmapIndexes(pendingMap bool) []ControlHostInfo {
129
129
}
130
130
}
131
131
132
+ // GetCertByVpnIp returns the authenticated certificate of the given vpn IP, or nil if not found
133
+ func (c * Control ) GetCertByVpnIp (vpnIp netip.Addr ) * cert.NebulaCertificate {
134
+ if c .f .myVpnNet .Addr () == vpnIp {
135
+ return c .f .pki .GetCertState ().Certificate
136
+ }
137
+ hi := c .f .hostMap .QueryVpnIp (vpnIp )
138
+ if hi == nil {
139
+ return nil
140
+ }
141
+ return hi .GetCert ()
142
+ }
143
+
144
+ // CreateTunnel creates a new tunnel to the given vpn ip.
145
+ func (c * Control ) CreateTunnel (vpnIp netip.Addr ) {
146
+ c .f .handshakeManager .StartHandshake (vpnIp , nil )
147
+ }
148
+
149
+ // PrintTunnel creates a new tunnel to the given vpn ip.
150
+ func (c * Control ) PrintTunnel (vpnIp netip.Addr ) * ControlHostInfo {
151
+ hi := c .f .hostMap .QueryVpnIp (vpnIp )
152
+ if hi == nil {
153
+ return nil
154
+ }
155
+ chi := copyHostInfo (hi , c .f .hostMap .GetPreferredRanges ())
156
+ return & chi
157
+ }
158
+
159
+ // QueryLighthouse queries the lighthouse.
160
+ func (c * Control ) QueryLighthouse (vpnIp netip.Addr ) * CacheMap {
161
+ hi := c .f .lightHouse .Query (vpnIp )
162
+ if hi == nil {
163
+ return nil
164
+ }
165
+ return hi .CopyCache ()
166
+ }
167
+
132
168
// GetHostInfoByVpnIp returns a single tunnels hostInfo, or nil if not found
133
169
// Caller should take care to Unmap() any 4in6 addresses prior to calling.
134
170
func (c * Control ) GetHostInfoByVpnIp (vpnIp netip.Addr , pending bool ) * ControlHostInfo {
You can’t perform that action at this time.
0 commit comments