-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
65 lines (56 loc) · 1.34 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import "./service"
import "net"
import "os"
import "fmt"
import "strings"
import "bufio"
//import "time"
// Currently for testing
func main(){
mask_list := make([]net.IPNet, 1)
mask_list[0].IP = net.ParseIP("127.0.0.1")
mask_list[0].Mask = net.IPMask(net.ParseIP("255.255.255.255"))
config := service.Config {
Username: "test",
Password: "test",
PubHostList: make(map[string]int64),
PrivHostList: make(map[string]int64),
ComPort: 33446,
MaskList: mask_list,
PublicPath: "E:\\Projects\\ML\\putty",
PrivatePath: "E:\\Forms\\garuda",
}
config.PubHostList["127.0.0.1"] = 0
serv := service.Service{
Config: &config,
Host: "127.0.0.1",
LPrivDir: make([]string, 1),
LPubDir: make([]string, 1),
RPrivDir: make([]string, 1),
RPubDir: make([]string, 1),
Files: make(map[string]bool),
}
//go serv.HostRenewal()
go (&serv).Lserver()
in := bufio.NewReader(os.Stdin)
for {
fmt.Print(">>> ")
first, _ := in.ReadString('\n')
args := strings.Split(strings.TrimSpace(first), " ")
if args[0]=="ls"{
serv.Host = args[1]
location := service.Location{
Priv: false,
Path: make([]string, 1),
}
if args[2]=="1"{
location.Priv=true
}
(&serv).GetDir(location)
for name, b := range (serv.Files) {
fmt.Println(name, b)
}
}
}
}