From 724b17ec5b25b57b477fd936ad8e52a4f18761e5 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Fri, 11 Mar 2022 12:39:28 -0500 Subject: obfsvpn: support gateway certificates Support creating dialers and listeners from the newer gateway certificates, as well as setting the cert argument when connecting. Signed-off-by: Sam Whited --- listener.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'listener.go') diff --git a/listener.go b/listener.go index 67a25e7..4163cb9 100644 --- a/listener.go +++ b/listener.go @@ -25,6 +25,19 @@ type ListenConfig struct { StateDir string } +// NewListenConfigCert creates a listener config by unpacking the node ID from +// its certificate. +// The private key must still be specified. +func NewListenConfigCert(cert string) (*ListenConfig, error) { + nodeID, _, err := unpackCert(cert) + if err != nil { + return nil, err + } + return &ListenConfig{ + NodeID: nodeID, + }, nil +} + // Listen announces on the local network address. // // See func net.Dial for a description of the network and address parameters. -- cgit v1.2.3