log.console(`nat client starting`)

$contact((actor, reason) => {
  if (actor) {
    log.console(`trying to message ${actor}`)
    send(actor, {type:"greet"})
  } else {
    log.console(reason)
  }
}, {
  address: "108.210.60.32",
  port: 4000,
  actor: $self
})

var handlers = {
  greet: function() {
    log.console(`hello!`)
  }
}

$receiver(e => {
  if (handlers[e.type]) handlers[e.type]()
})