log.console(`nat client starting`)

$_.contact((actor, reason) => {
  if (actor) {
    log.console(`trying to message ${json.encode(actor)}`)
    send(actor, {type:"greet"})
  } else {
    log.console(json.encode(reason))
  }
}, {
  address: "108.210.60.32",  // NAT server's public IP
  port: 4000,
  actor: $_
})

$_.receiver(e => {
  switch(e.type) {
    case 'greet':
      log.console(`hello!`)
      break
  }
})