-
Notifications
You must be signed in to change notification settings - Fork 4
/
func.cli.go
55 lines (42 loc) · 1.51 KB
/
func.cli.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
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"path/filepath"
)
// FileModeApplication will run the File Mode application logic bootstrap
func (config CLIOpts) FileModeApplication() {
logStdOut("Source file: " + config.Source)
logStdOut("Target directory: " + config.Dir)
absoluteTargetDirectory, err := filepath.Abs(config.Dir)
check(err)
// Initialize the Target Directory
if err := ValidateConfigDirectory(absoluteTargetDirectory); err != nil {
logStdErr("Target directory unwritable!")
} else {
directoryCheck, err := DirectoryExists(absoluteTargetDirectory)
check(err)
if !directoryCheck {
//Directory doesn't exist, create
CreateDirectory(absoluteTargetDirectory)
}
}
CreateDirectory(absoluteTargetDirectory + "/config")
CreateDirectory(absoluteTargetDirectory + "/zones")
// Read in Zones file
server, err := NewDNSServer(config)
check(err)
//zones := server.Zones
revViewPair, err := GenerateBindReverseZoneFiles(&server.DNS, absoluteTargetDirectory)
check(err)
_, err = GenerateBindConfig(&server.DNS, absoluteTargetDirectory, revViewPair)
check(err)
_, err = GenerateBindZoneConfigFile(&server.DNS, absoluteTargetDirectory)
check(err)
_, err = GenerateBindZoneFiles(&server.DNS, absoluteTargetDirectory)
check(err)
//_, err = LoopThroughZonesForBindConfig(server, absoluteTargetDirectory)
//check(err)
//_, err = LoopThroughZonesForBindZonesFiles(&server.DNS.Zones, absoluteTargetDirectory)
//check(err)
//_, err = LoopThroughZonesForBindReverseV4ZonesFiles(zones, absoluteTargetDirectory)
//check(err)
}