diff options
author | Sam Whited <sam@samwhited.com> | 2022-03-11 12:39:28 -0500 |
---|---|---|
committer | Sam Whited <sam@samwhited.com> | 2022-03-11 12:41:34 -0500 |
commit | 724b17ec5b25b57b477fd936ad8e52a4f18761e5 (patch) | |
tree | 404c39ac564833df5a0fdef14650ba70355a2d99 /listener.go | |
parent | 263e27bfa13147a84377790fce14f5a5b5845994 (diff) |
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 <sam@samwhited.com>
Diffstat (limited to 'listener.go')
-rw-r--r-- | listener.go | 13 |
1 files changed, 13 insertions, 0 deletions
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. |