1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

check if file exists

This commit is contained in:
Zack Scholl 2018-06-30 09:01:30 -07:00
parent 0d5836b4e8
commit f1b62ea30d
4 changed files with 23 additions and 6 deletions

View file

@ -2,6 +2,7 @@ package main
import (
"flag"
"fmt"
croc "github.com/schollz/croc/src"
)
@ -10,17 +11,20 @@ func main() {
var err error
role := flag.Int("role", 0, "role number")
passphrase := flag.String("code", "chou", "codephrase")
fname := flag.String("file", "", "codephrase")
flag.Parse()
c := croc.Init()
// croc.SetLogLevel("error")
if *role == -1 {
err = c.Relay()
} else if *role == 0 {
err = c.Send("README.md", *passphrase)
err = c.Send(*fname, *passphrase)
} else {
err = c.Receive(*passphrase)
}
if err != nil {
panic(err)
fmt.Print("Error: ")
fmt.Println(err.Error())
}
}