3
0
Fork 0

Compare commits

...

6 Commits

Author SHA1 Message Date
micha3lbrown 12e146fff2
Add logLocalTZ to Site.swift 2021-01-14 17:01:31 -05:00
Michael Brown affdc8a7bb
Add configuration setting for using local TZ
The default log timestamp is in UTC, this commit allows the user to
convert the log timestamps to their own timezone.

When approaching this problem I originally considered allowing the user
to set any timezone offset of their choice. This would require some
alignment between the device and client that was feeling cumbersome.

In the end we decided to keep things relatively simple and just allow a
simple toggle to convert log entries upon reading the logfile on the
device.

The default log timestamp emitted by the client remains UTC/Zulu

Advances #2
2020-12-16 10:36:15 -05:00
Michael Brown 2c2aa3d2b0
Remove unused function `_getString` 2020-12-16 10:23:54 -05:00
Michael Brown 150e3d2efc
Remove backend config mapping for logUserTZ
Since logUserTZ conversion will happen on the frontend, we no longer
need to store this configuration in the Nebula agent config.
2020-12-16 10:14:41 -05:00
Michael Brown fe816a926d
Add `logUserTZ` option
- Adding function descriptions for exported functions
2020-12-16 10:00:40 -05:00
Michael Brown 4e6b18b07d
README.md updates for Android 2020-12-15 17:20:30 -05:00
13 changed files with 139 additions and 15 deletions

View File

@ -22,9 +22,36 @@ flutter format lib/ test/ -l 120
# Release
Update `version` in `pubspec.yaml` to reflect this release, then
## Android
# Android
## Terminology
APK: Android Package
ADB: Android Debug Bridge - A tool for interacting with running emulators
AVD: Android Virtual Device Manager - A tool for launching, configuring and managing emulators
# `ADB` (Android Debug Bridge)
Android Debug Bridge is an executible that can be found under `~/Android/Sdk/platform-tools/adb` for ease of use add `~/Android/Sdk/platform-tools/` to your `$PATH`. `adb` surfaces a few useful commands.
You can sideload a downloaded APK into a running emulator
```
$ adb install ~/Downloads/Ping_v1.7.03_apkpure.com.apk
Performing Streamed Install
Success
```
You can also use shell to access network utilities like ping
```
$ adb shell ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.206 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.056 ms
...
```
## Release
Update `version` in `pubspec.yaml` to reflect this release, then
`flutter build appbundle --no-shrink`
@ -32,6 +59,9 @@ This will create an android app bundle at `build/app/outputs/bundle/release/`
Upload the android bundle to the google play store https://play.google.com/apps/publish
## iOS
# iOS
In xcode, Release -> Archive then follow the directions to upload to the app store. If you have issues, https://flutter.dev/docs/deployment/ios#create-a-build-archive
## Release
Update `version` in `pubspec.yaml` to reflect this release, then

View File

@ -142,6 +142,7 @@ class Site {
val cipher: String
val sortKey: Int
var logVerbosity: String
var logLocalTZ: Boolean?
var connected: Boolean?
var status: String?
val logFile: String?
@ -172,6 +173,7 @@ class Site {
sortKey = incomingSite.sortKey ?: 0
logFile = siteDir.resolve("log").absolutePath
logVerbosity = incomingSite.logVerbosity ?: "info"
logLocalTZ = incomingSite.logLocalTZ ?: false
connected = false
status = "Disconnected"
@ -251,6 +253,7 @@ class IncomingSite(
val cipher: String,
val sortKey: Int?,
var logVerbosity: String?,
val logLocalTZ: Boolean?,
@Expose(serialize = false)
var key: String?
) {

View File

@ -150,6 +150,7 @@ struct Site: Codable {
var mtu: Int
var cipher: String
var sortKey: Int
var logLocalTZ: Bool?
var logVerbosity: String
var connected: Bool?
var status: String?
@ -238,6 +239,7 @@ struct Site: Codable {
port = incoming.port
cipher = incoming.cipher
sortKey = incoming.sortKey ?? 0
logLocalTZ = incoming.logLocalTZ ?? false
logVerbosity = incoming.logVerbosity ?? "info"
mtu = incoming.mtu ?? 1300
logFile = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.net.defined.mobileNebula")?.appendingPathComponent(id).appendingPathExtension("log").path
@ -284,6 +286,7 @@ struct Site: Codable {
case status
case logFile
case unsafeRoutes
case logLocalTZ
case logVerbosity
case errors
case mtu
@ -314,6 +317,7 @@ struct IncomingSite: Codable {
var mtu: Int?
var cipher: String
var sortKey: Int?
var logLocalTZ: Bool?
var logVerbosity: String?
var key: String?

View File

@ -109,4 +109,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: e8d4fb1ed5b0713de2623a28dfae2585e15c0d00
COCOAPODS: 1.9.0
COCOAPODS: 1.10.0

View File

@ -43,6 +43,7 @@ class Site {
String status;
String logFile;
String logVerbosity;
bool logLocalTZ;
// A list of errors encountered while loading the site
List<String> errors;
@ -62,6 +63,7 @@ class Site {
this.status,
this.logFile,
this.logVerbosity = 'info',
this.logLocalTZ,
errors,
unsafeRoutes})
: staticHostmap = staticHostmap ?? {},
@ -105,6 +107,7 @@ class Site {
sortKey = json['sortKey'];
logFile = json['logFile'];
logVerbosity = json['logVerbosity'];
logLocalTZ = json['logLocalTZ'];
connected = json['connected'] ?? false;
status = json['status'] ?? "";
@ -154,6 +157,7 @@ class Site {
'cipher': cipher,
'sortKey': sortKey,
'logVerbosity': logVerbosity,
'logLocalTZ': logLocalTZ,
};
}

View File

@ -105,8 +105,10 @@ class _SiteLogsScreenState extends State<SiteLogsScreen> {
loadLogs() async {
var file = File(widget.site.logFile);
try {
final v = await file.readAsString();
String v = await file.readAsString();
if(widget.site.logLocalTZ) {
v = convertToLocalTZ(v);
}
setState(() {
logs = v;
});
@ -115,6 +117,17 @@ class _SiteLogsScreenState extends State<SiteLogsScreen> {
}
}
convertToLocalTZ(String rawLog) {
// Regex to extract time value
rawLog = rawLog.replaceAllMapped(RegExp('time="(.*?)"'), (match){
// Convert to DateTime with the inner match from above
DateTime userDate = DateTime.parse(match.group(1));
// Return timestamp in format that matches default
return 'time="${userDate.toLocal().toIso8601String()}"';
});
return rawLog;
}
deleteLogs() async {
var file = File(widget.site.logFile);
await file.writeAsBytes([]);

View File

@ -28,6 +28,7 @@ class Advanced {
String verbosity;
List<UnsafeRoute> unsafeRoutes;
int mtu;
bool logLocalTZ;
}
class AdvancedScreen extends StatefulWidget {
@ -52,6 +53,7 @@ class _AdvancedScreenState extends State<AdvancedScreen> {
settings.verbosity = widget.site.logVerbosity;
settings.unsafeRoutes = widget.site.unsafeRoutes;
settings.mtu = widget.site.mtu;
settings.logLocalTZ = widget.site.logLocalTZ;
super.initState();
}
@ -131,6 +133,22 @@ class _AdvancedScreenState extends State<AdvancedScreen> {
});
});
}),
ConfigItem(
label: Text('Use Local Time Zone'),
labelWidth: 200,
content: Align(
alignment: Alignment.centerRight,
child: Switch.adaptive(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
value: settings.logLocalTZ,
onChanged: (value) {
setState(() {
settings.logLocalTZ = value;
changed = true;
});
},
)),
),
ConfigPageItem(
label: Text('Log verbosity'),
labelWidth: 150,

View File

@ -218,6 +218,7 @@ class _SiteConfigScreenState extends State<SiteConfigScreen> {
site.lhDuration = settings.lhDuration;
site.port = settings.port;
site.logVerbosity = settings.verbosity;
site.logLocalTZ = settings.logLocalTZ;
site.unsafeRoutes = settings.unsafeRoutes;
site.mtu = settings.mtu;
});

View File

@ -30,14 +30,6 @@ class Settings {
_set('darkMode', enabled);
}
String _getString(String key, String defaultValue) {
final val = _settings[key];
if (val is String) {
return val;
}
return defaultValue;
}
bool _getBool(String key, bool defaultValue) {
final val = _settings[key];
if (val is bool) {

View File

@ -18,6 +18,7 @@ type Nebula struct {
l *logrus.Logger
}
// NewNebula assembles config and certificates to return a Nebula Client
func NewNebula(configData string, key string, logFile string, tunFd int) (*Nebula, error) {
// GC more often, largely for iOS due to extension 15mb limit
debug.SetGCPercent(20)
@ -34,6 +35,8 @@ func NewNebula(configData string, key string, logFile string, tunFd int) (*Nebul
}
l := logrus.New()
// Set logrus output to write to logfile
f, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return nil, err
@ -56,22 +59,27 @@ func NewNebula(configData string, key string, logFile string, tunFd int) (*Nebul
return &Nebula{c, l}, nil
}
// Start is a handler function for downstream libries to manage the Nebula service
func (n *Nebula) Start() {
n.c.Start()
}
// ShutdownBlock is a handler function for downstream libries to manage the Nebula service
func (n *Nebula) ShutdownBlock() {
n.c.ShutdownBlock()
}
// Stop is a handler function for downstream libries to manage the Nebula service
func (n *Nebula) Stop() {
n.c.Stop()
}
// Rebind is a handler function for downstream libries to manage the Nebula service
func (n *Nebula) Rebind() {
n.c.RebindUDPServer()
}
// ListHostmap is a handler function for downstream libries to manage the Nebula service
func (n *Nebula) ListHostmap(pending bool) (string, error) {
hosts := n.c.ListHostmap(pending)
b, err := json.Marshal(hosts)
@ -82,6 +90,7 @@ func (n *Nebula) ListHostmap(pending bool) (string, error) {
return string(b), nil
}
// GetHostInfoByVpnIp is a handler function for downstream libries to manage the Nebula service
func (n *Nebula) GetHostInfoByVpnIp(vpnIp string, pending bool) (string, error) {
b, err := json.Marshal(n.c.GetHostInfoByVpnIP(stringIpToInt(vpnIp), pending))
if err != nil {
@ -91,10 +100,12 @@ func (n *Nebula) GetHostInfoByVpnIp(vpnIp string, pending bool) (string, error)
return string(b), nil
}
// CloseTunnel takes a VPN IP and closes the corresponding tunnel
func (n *Nebula) CloseTunnel(vpnIp string) bool {
return n.c.CloseTunnel(stringIpToInt(vpnIp), false)
}
// SetRemoteForTunnel is a wrapper function for Nebula's SetRemoteForTunnel
func (n *Nebula) SetRemoteForTunnel(vpnIp string, addr string) (string, error) {
udpAddr := nebula.NewUDPAddrFromString(addr)
if udpAddr == nil {

View File

@ -8,6 +8,7 @@ require (
github.com/slackhq/nebula v1.3.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/mobile v0.0.0-20200801112145-973feb4309de // indirect
golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65 // indirect
golang.org/x/tools v0.0.0-20201211025543-abf6a1d87e11 // indirect
golang.org/x/tools/gopls v0.5.5 // indirect
gopkg.in/yaml.v2 v2.2.7
)

View File

@ -1,3 +1,5 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
@ -35,13 +37,17 @@ github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ=
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kardianos/service v1.0.0/go.mod h1:8CzDhVuCuugtsHyZoTvsOBuvonN/UDBvl0kH+BUxvbo=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@ -82,6 +88,11 @@ github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLk
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@ -106,6 +117,9 @@ github.com/vishvananda/netlink v1.0.1-0.20190522153524-00009fb8606a h1:Bt1IVPhiC
github.com/vishvananda/netlink v1.0.1-0.20190522153524-00009fb8606a/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@ -118,18 +132,22 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnk
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20200329125638-4c31acba0007 h1:JxsyO7zPDWn1rBZW8FV5RFwCKqYeXnyaS/VQPLpXu6I=
golang.org/x/mobile v0.0.0-20200329125638-4c31acba0007/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
golang.org/x/mobile v0.0.0-20200801112145-973feb4309de h1:OVJ6QQUBAesB8CZijKDSsXX7xYVtUhrkY0gwMfbi4p4=
golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
golang.org/x/mobile v0.0.0-20201208152944-da85bec010a2 h1:3HADozU50HyrJ2jklLtr3xr0itFkz9u4LxCJhqKVdjI=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd h1:ePuNC7PZ6O5BzgPn9bZayERXBdfZjUYoXEf5BTfDfh8=
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@ -138,13 +156,20 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -158,27 +183,48 @@ golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 h1:gSbV7h1NRL2G1xTg/owz62CST
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69 h1:yBHHx+XZqXJBm6Exke3N7V9gnlsyXxoCPEb1yVenjfk=
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200410194907-79a7a3126eef/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65 h1:DajXNh69ob79PCQz1N7OHxmqq6ASZC5xAnJJWIQGR6I=
golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
golang.org/x/tools v0.0.0-20201204180437-c46b611624b3 h1:uxH+MECLNmX/vsPe4txyeQ1LCmhdUxf7p4hjkHexg+c=
golang.org/x/tools v0.0.0-20201204180437-c46b611624b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201211025543-abf6a1d87e11 h1:9j/upNXDRpADUw2RpUfJ7E7GHtfhDih62kX6JM8vs2c=
golang.org/x/tools v0.0.0-20201211025543-abf6a1d87e11/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools/gopls v0.5.5 h1:YBLs2WCwxx6mBF98Y6/mDIpKhP4Dt4Dz2q6LnMRBpDw=
golang.org/x/tools/gopls v0.5.5/go.mod h1:nlmBkZ+SmMGZGmdbx5ZVUxtSUE+ffWk7FitRz9FfkdM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
honnef.co/go/tools v0.0.1-2020.1.6/go.mod h1:pyyisuGw24ruLjrr1ddx39WE0y9OooInRzEYLhQB2YY=
mvdan.cc/gofumpt v0.0.0-20200927160801-5bfeb2e70dd6 h1:z+/YqapuV7VZPvBb3GYmuEJbA88M3PFUxaHilHYVCpQ=
mvdan.cc/gofumpt v0.0.0-20200927160801-5bfeb2e70dd6/go.mod h1:bzrjFmaD6+xqohD3KYP0H2FEuxknnBmyyOxdhLdaIws=
mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8=

View File

@ -42,6 +42,7 @@ type KeyPair struct {
PrivateKey string
}
// RenderConfig reads a JSON config, maps to corresponding structs and returns a yaml config
func RenderConfig(configData string, key string) (string, error) {
config := newConfig()
var d m