croc/src/api.go

23 lines
536 B
Go
Raw Normal View History

2018-06-28 16:46:16 +02:00
package croc
// Relay initiates a relay
func (c *Croc) Relay() error {
// start relay
2018-06-28 19:12:04 +02:00
go c.startRelay(c.TcpPorts)
2018-06-28 16:46:16 +02:00
// start server
2018-06-28 19:12:04 +02:00
return c.startServer(c.TcpPorts, c.ServerPort)
2018-06-28 16:46:16 +02:00
}
// Send will take an existing file or folder and send it through the croc relay
2018-06-30 04:34:21 +02:00
func (c *Croc) Send(fname string, codephrase string) (err error) {
2018-06-30 07:07:33 +02:00
err = c.client(0, codephrase, fname)
2018-06-28 16:46:16 +02:00
return
}
// Receive will receive something through the croc relay
2018-06-30 04:34:21 +02:00
func (c *Croc) Receive(codephrase string) (err error) {
err = c.client(1, codephrase)
2018-06-28 16:46:16 +02:00
return
}