mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 21:30:16 +02:00
fix options
This commit is contained in:
parent
fa1b2af314
commit
837a66e975
4 changed files with 17 additions and 5 deletions
6
src/cleanup.go
Normal file
6
src/cleanup.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package croc
|
||||
|
||||
func (c *Croc) cleanup() {
|
||||
// TODO
|
||||
// erase all the croc files and their possible numbers
|
||||
}
|
|
@ -58,7 +58,8 @@ func (c *Croc) client(role int, codePhrase string, fname ...string) (err error)
|
|||
// connect to the websocket
|
||||
// TODO:
|
||||
// use predefined host and HTTPS, if exists
|
||||
u := url.URL{Scheme: "ws", Host: "localhost:8003", Path: "/"}
|
||||
|
||||
u := url.URL{Scheme: strings.Split(c.WebsocketAddress, "://")[0], Host: strings.Split(c.WebsocketAddress, "://")[1], Path: "/"}
|
||||
log.Debugf("connecting to %s", u.String())
|
||||
ws, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -216,6 +216,7 @@ func (c *Croc) processReceivedFile() (err error) {
|
|||
log.Error(err)
|
||||
return
|
||||
}
|
||||
os.Remove(c.crocFile)
|
||||
c.cs.channel.finishedHappy = true
|
||||
return
|
||||
}
|
||||
|
|
|
@ -16,9 +16,13 @@ const (
|
|||
)
|
||||
|
||||
type Croc struct {
|
||||
TcpPorts []string
|
||||
ServerPort string
|
||||
Timeout time.Duration
|
||||
// Options for connecting to server
|
||||
TcpPorts []string
|
||||
WebsocketAddress string
|
||||
ServerPort string
|
||||
Timeout time.Duration
|
||||
|
||||
// Options for file transfering
|
||||
UseEncryption bool
|
||||
UseCompression bool
|
||||
CurveType string
|
||||
|
@ -41,12 +45,12 @@ type Croc struct {
|
|||
func Init() (c *Croc) {
|
||||
c = new(Croc)
|
||||
c.TcpPorts = []string{"27001", "27002", "27003", "27004"}
|
||||
c.ServerPort = "8003"
|
||||
c.Timeout = 10 * time.Minute
|
||||
c.UseEncryption = true
|
||||
c.UseCompression = true
|
||||
c.AllowLocalDiscovery = true
|
||||
c.CurveType = "p521"
|
||||
c.WebsocketAddress = "ws://localhost:8003"
|
||||
c.rs.Lock()
|
||||
c.rs.channel = make(map[string]*channelData)
|
||||
c.cs.channel = new(channelData)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue