-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (37 loc) · 831 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
/*
#include <flux/core.h>
#include <flux/idset.h>
#include <flux/hostlist.h>
#include <stddef.h>
#include <jansson.h>
#include <stdlib.h>
*/
import "C"
import (
"fmt"
"os"
"github.com/flux-framework/flux-core/pkg/flux"
)
// getHostname gets the hostname
func getHostname() string {
hostname, err := os.Hostname()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
return hostname
}
func main() {
fmt.Println("⭐️ Testing flux keygen in Go! ⭐️")
// A name for the certificate - this is often the hostname
fmt.Println("Generating to path...")
hostname := getHostname()
name := "curve-cert"
// Path to the certificate to save
path := "./curve.cert"
flux.KeyGen(name, hostname, path)
fmt.Println("Generating to string...")
curveCert := flux.KeyGen(name, hostname, "")
fmt.Println(curveCert)
}