Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
simplify everything
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Oct 24, 2018
1 parent d78baab commit 69b19e9
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 239 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ matrix:

env:
global:
- RELEASE_ARCHIVE_NAME=fly-${TRAVIS_OS_NAME}-x64.tar.gz
- DNS_RELEASE_FILENAME=fly-dns-${TRAVIS_OS_NAME}-x64.gz
cache:
cargo: true
yarn: true
Expand Down Expand Up @@ -61,18 +61,19 @@ script:
- cargo build --release --bin create_snapshot
- ls -lah target/release
- target/release/create_snapshot v8env/dist/v8env.js v8env.bin
- cargo build --release
- cargo build --bin dns --release

before_deploy:
- strip target/release/server && strip target/release/dns
- tar czf ${RELEASE_ARCHIVE_NAME} -C target/release server dns
- strip target/release/dns
- cp target/release/dns fly-dns
- gzip -c fly-dns > ${DNS_RELEASE_FILENAME}

deploy:
provider: releases
overwrite: true
api_key:
secure: VsCHyGpPc02F3LiK+nqMDSPSEKmzgKyAhwVJQJ2mLjso74N1NGRsCDgKIQAOoLzcJRVNZFrpnlbOxKoyTGg1x8b6MnpPmqR8j/LVdKoud6Nhp8Ufw1I/9XwPpyjAhSNKnQq+1h1DpbWbob4bS5BR23PRbIySPUx570W3G8y3IritqorvpM4Qn12fyetWoZxRxWt9QAnrEV2Pj8ULR1C2jBtQPNAVLKm5FcDPBxzQcqXRZjARQtdjNU5tOB1bEm4zg8QNl/hDHi+5WZ/FQ/gZR28cAdhAb8GTC8UU7hTP5TTt2G1UimI27RPxyAyc/eJ9JU2ixRGzjDPvv6hk+KkGGjvuJccKHqR+bgHJ8lS8gPPmpvRMM9uVTAsI/pPA51OgveaHknMCCefiDYGgMq2cIW3UmUMHaB1m9SmBrIqCfEOwPp8f4KEtO55B9myuvqOYvlL4pJrcSUucjNGkm7guqCR4u3L3D0cIkTyk3fTbZyaeAxkSlcYvcff8BpRuFI8YiTybtLxqy0+KoDNoXr/d34/dwFyQNeRPN7H4EWGkzFeHpbfm+aCXGtqF8fMj/tOT7yrOAwy2rvD9/Gx8nzdY7j+DMIXB9HAR3y5Xrpiba0nedV4jww2s1dKuf96Iac3CZrO1qOXvNMKPCVSrp/rmQ5r6REfTQDe6NBONPvjjTX0=
file: ${RELEASE_ARCHIVE_NAME}
file: ${DNS_RELEASE_FILENAME}
skip_cleanup: true
on:
repo: superfly/fly.rs
Expand Down
31 changes: 14 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ log = "*"
env_logger = "*"
lazy_static = "1.1"
lazy-static-include = "1.2"
toml = "0.4"
libc = "*"
flatbuffers = { path = "./third_party/flatbuffers/rust/flatbuffers" }
serde = "*"
serde_derive = "1.0"
hyper = "0.12"
hyper-tls = "0.3"
http = "0.1"
Expand All @@ -36,7 +33,6 @@ trust-dns = "0.15.0-alpha.2"
trust-dns-proto = "0.5.0-alpha.3"
tokio-fs = "0.1"
tokio-codec = "0.1"
num_cpus = "1"
glob = "0.2"
clap = "2.32"

Expand Down
138 changes: 65 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,70 @@
# Fly Edge Runtime
# Fly DNS Apps

## A multi-tenant, v8 based runtime for building Edge Apps
## Handling DNS requests with JavaScript

This is the next generation version of [fly](superfly/fly), and replaces the Node / isolated-vm portions of the runtime with a native Rust + v8 binary. It's much faster. And much more concurrent. Plus it's Rust so it's more fun.
This is a programmable DNS server. You can write JavaScript to handle DNS queries any way you want.

## Installation

### MacOS and Linux

[Download the latest release](/superfly/fly.rs/releases) for your platform, ungzip and put the binary somewhere

### Windows

Unavailable. Relevant issue: [#9](/superfly/fly.rs/issues/9)

## Usage

```
fly-dns --port 8053 relative/path/to/file.js
```

## Examples

### Simple proxy

```javascript
// Handle an event for a DNS request
addEventListener("resolv", event => {
event.respondWith( // this function responds to the DNS request event
resolv( // the resolv function resolves DNS queries
event.request.queries[0] // picks the first DNSQuery in the request
)
)
})
```

### Static response

```javascript
addEventListener("resolv", event => {
event.respondWith(function () { // can respond with a function
return {
authoritative: true, // hopefully you know what you're doing
answers: [ // list of DNS answers
{
name: event.request.queries[0].name, // name of the DNS entry
rrType: DNSRecordType.A, // record type
ttl: 300, // time-to-live for the client
data: "127.0.0.1" // data for the record
}
]
}
})
})
```

## Fly & Deno

The Fly runtime was originally derived from [deno](denoland/deno) and shares some of the same message passing semantics. It has diverged quite a bit, but when possible we'll be contributing code back to deno.

There's an issue: [#5](/superfly/fly.rs/issues/5)

## Development

### Setup

- `wget -qO- https://github.com/superfly/libv8/releases/download/7.1.321/v8-osx-x64.tar.gz | tar xvz -C libfly`
- `git submodule update --init`
- `cd third_party/flatbuffers`
Expand All @@ -17,77 +76,10 @@ This is the next generation version of [fly](superfly/fly), and replaces the Nod
- `yarn install`
- `rollup -c`
- `cd ..`
- `cargo run --bin server`
- `cargo run --bin dns`

## Running v8env tests
### Running v8env tests

```
cargo run --bin test "v8env/tests/**/*.spec.js"
```

## Fly & Deno

The Fly runtime was originally derived from [deno](denoland/deno) and shares some of the same message passing semantics. It has diverged quite a bit, but when possible we'll be contributing code back to deno.

## TODO

- [x] Send `print` (all `console.x` calls) back into Rust to handle in various ways
- [x] Send errors to stderr
- [x] Use envlogger (`debug!`, `info!`, etc. macros) for messages
- [ ] Allow sending to graylog or something external
- [ ] Feature-parity
- [ ] Image API
- [ ] Cache
- [ ] Expire (set ttl)
- [ ] TTL (get ttl)
- [ ] Tags / purge
- [ ] global.purgeTag / del
- [ ] Testing
- [ ] Runtime
- [ ] Lifecycle management
- [ ] Gracefully "replace" if running out of heap
- [ ] Handle promise rejection (trash the runtime? just log?)
- [ ] Handle uncaught error (trash? log?)
- [ ] Builder
- [ ] TypeScript support
- [ ] HTTP imports!
- [ ] Source maps
- [ ] Handle source maps in the rust hook
- [ ] CI builds + releases
- [x] Mac
- [x] Linux
- [ ] Windows
- HTTP
- [ ] Actually use the config hostnames and correct app
- [x] Spawn multiple runtime instances for the same app (n cpus? configurable?)
- [ ] Add `Server` header for Fly and current version (maybe?)
- [ ] Fetch request bodies
- [ ] TLS
- [ ] Explore handling TLS handshakes and responding
- [ ] JS API
- [ ] Rust serialization
- [ ] TCP
- [ ] Explore handling raw TCP packets (decrypted) and responding
- [ ] JS API
- [ ] Rust serialization
- [ ] UDP
- [ ] Explore handling UDP packets and responding
- [ ] JS API
- [ ] Rust serialization
- [x] DNS
- [x] Explore handling DNS requests and responding
- [x] JS API
- [x] Rust server
- [x] Rust serialization
- [ ] DNSSEC
- [ ] DNS over TLS
- [ ] Observability
- [ ] Exception reporting (via Sentry probably)
- [ ] Metrics (prometheus)
- Stability / Resilience
- [ ] do not use `unwrap` (that will panic and exit the process). Solution is to handle them and return or print proper errors
- [x] Get rid of all warnings
- [ ] Tests!
- [ ] Optimizations
- [ ] Flatbuffers can be build without allocations, by using `addX` like we do in javascript
- [ ] Reuse ArrayBuffer in certain cases
```
10 changes: 0 additions & 10 deletions fly.toml

This file was deleted.

Loading

0 comments on commit 69b19e9

Please sign in to comment.