Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fildev demo #1672

Merged
merged 251 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
251 commits
Select commit Hold shift + click to select a range
35758b8
Add basic ability to create a payment channel
lalexgap Sep 11, 2023
844d892
remove payee/payer and show channel id
lalexgap Sep 11, 2023
a2f77e4
remove commented out code
lalexgap Sep 12, 2023
59ef3c6
remove cost per byte from UI
lalexgap Sep 12, 2023
264e60f
move button
lalexgap Sep 12, 2023
9dcee9b
tweak ui
lalexgap Sep 12, 2023
069da0a
catch 402 error
lalexgap Sep 12, 2023
84cee17
remove total cost
lalexgap Sep 12, 2023
b10af83
tweak label name
lalexgap Sep 12, 2023
acf7833
better useMicroPayments check
lalexgap Sep 12, 2023
15d9e33
enable button when nitro client is enabled
lalexgap Sep 12, 2023
6054dbe
use r.ContentLength to check size
lalexgap Sep 12, 2023
0f276b2
get content length from body if needed
lalexgap Sep 12, 2023
62efeb1
larger starting balance
lalexgap Sep 12, 2023
6fdc841
rebuild when ui or ts client is updated
lalexgap Sep 12, 2023
c1e4450
store channel id in local storage
lalexgap Sep 12, 2023
cd0acaa
use env vars for configuration
lalexgap Sep 13, 2023
bfad680
include channel amount as env var
lalexgap Sep 13, 2023
1c4154a
add .env.production
geoknee Sep 13, 2023
a05f05e
fix typos
geoknee Sep 13, 2023
0a5dd3b
point prod to use anthony
lalexgap Sep 13, 2023
948ac92
update to cloud node addresses
lalexgap Sep 13, 2023
91e48c1
lower prod balance
lalexgap Sep 13, 2023
7138c09
log out error to console
lalexgap Sep 13, 2023
edb3b82
Use Anthony as bootpeer for Brad
bitwiseguy Sep 13, 2023
b48219d
Switch from net.Listen to http.Server.ListenAndServe
kerzhner Sep 6, 2023
1505d42
Add tls to http transport
kerzhner Sep 8, 2023
7759cb6
Add test tls key and cert to git
kerzhner Sep 12, 2023
2cb7616
Block transport start until socket is ready
kerzhner Sep 12, 2023
68006f0
Use exponential backoff for http client retries
kerzhner Sep 12, 2023
c6d08db
Add tls to rpc typescript client
kerzhner Sep 13, 2023
60fbbe9
Remove unused imports
kerzhner Sep 13, 2023
37991c7
accept certificate as a parameter
lalexgap Sep 13, 2023
4b5bd2f
Return err instead of panicking
kerzhner Sep 13, 2023
b78f6b2
specify cert file
lalexgap Sep 13, 2023
1f2ed7b
correct path
lalexgap Sep 13, 2023
c2b52a1
copy certs over
lalexgap Sep 13, 2023
097fdff
use actual certs
lalexgap Sep 14, 2023
1cb5e64
use anthony node domain name
lalexgap Sep 14, 2023
0750f0f
include certs in docker volume
lalexgap Sep 14, 2023
da62f50
remove unsecurehttpsagent
lalexgap Sep 14, 2023
5cf6788
add brad to to anthony boot peers
lalexgap Sep 14, 2023
3d5ede3
add missing dependency
geoknee Sep 14, 2023
2307c5d
drop in a template
geoknee Sep 14, 2023
b4bd61c
use linear stepper
geoknee Sep 14, 2023
570f8ac
use switches
geoknee Sep 14, 2023
17ce2bf
tweak spacing
geoknee Sep 14, 2023
050932b
silence the linter
geoknee Sep 14, 2023
f769f7f
bump versions number and deploy to npm
geoknee Sep 14, 2023
52e91bb
Add github action to deploy patsy (the proxy) (#1709)
geoknee Sep 14, 2023
8668e2a
nitro rpc server only loads cert if provided file
lalexgap Sep 14, 2023
3fd1232
Merge remote-tracking branch 'origin/main' into update-wss
lalexgap Sep 14, 2023
2de8664
Merge branch 'wss' into update-wss
lalexgap Sep 14, 2023
b58b5b3
slightly larger balance
lalexgap Sep 14, 2023
3662942
set default file url
lalexgap Sep 14, 2023
2aa5d3f
update default url to w3
lalexgap Sep 14, 2023
b1e98e6
remove channel from storage if not found on node
lalexgap Sep 13, 2023
45e5839
remove ?
lalexgap Sep 15, 2023
dc49438
Merge pull request #1702 from statechannels/handle-missing-channel
lalexgap Sep 15, 2023
70e3f3c
Merge remote-tracking branch 'origin/wss' into update-wss
lalexgap Sep 15, 2023
6844caa
add support for tls to proxy
lalexgap Sep 14, 2023
13e2a12
use cert when deploying
lalexgap Sep 14, 2023
0be464b
do not copy config
lalexgap Sep 14, 2023
80e41a4
add health check
lalexgap Sep 14, 2023
8cef04e
add health checkpoint
lalexgap Sep 14, 2023
12c9a34
just use 443
lalexgap Sep 14, 2023
8ba7f8d
pass in cert o TLS serve and listen
lalexgap Sep 14, 2023
36a6a40
fix test
lalexgap Sep 14, 2023
7cc1e38
try w3
lalexgap Sep 14, 2023
43f5e3f
add sequence diagram for demo
geoknee Sep 15, 2023
ae9fd84
rename to app2
geoknee Sep 15, 2023
5d03632
move functions to utils folder
geoknee Sep 15, 2023
9b4851e
Revert "move functions to utils folder"
geoknee Sep 15, 2023
d157b78
factor out constants
geoknee Sep 15, 2023
fcf8598
more constants
geoknee Sep 15, 2023
b39cc1c
first attempt at wiring up app2
geoknee Sep 15, 2023
fc107fc
fix import err
geoknee Sep 15, 2023
bf4b598
move error text and handle errors better
geoknee Sep 15, 2023
384ef38
enable system preference dark/light mode
geoknee Sep 15, 2023
57b2cfd
disallow progress if no client
geoknee Sep 15, 2023
4084ee4
fix then / catch logic
geoknee Sep 15, 2023
3ce5e09
! not !!
geoknee Sep 15, 2023
3b04f04
activate link for explainer
geoknee Sep 15, 2023
65c07ed
wire up slider
geoknee Sep 15, 2023
287abd6
adorn error
geoknee Sep 15, 2023
17bc62b
conditionally render error alert
geoknee Sep 15, 2023
48d249a
rip out old implementation
geoknee Sep 15, 2023
df8e8e6
Merge pull request #1716 from statechannels/update-wss
geoknee Sep 15, 2023
265c774
Merge pull request #1713 from statechannels/tls-proxy
geoknee Sep 15, 2023
150c842
correct diagram
geoknee Sep 15, 2023
19ce144
remove old diagram
geoknee Sep 15, 2023
e46c5d6
remove use micropayments switch
geoknee Sep 15, 2023
295c644
wire up skip payment switch
geoknee Sep 15, 2023
735e661
remove copy
lalexgap Sep 15, 2023
d5f41c0
Merge remote-tracking branch 'origin/main' into fildev-payment-client
lalexgap Sep 15, 2023
82fe0be
Merge pull request #1722 from statechannels/remove-copy
lalexgap Sep 15, 2023
d3d598f
Merge pull request #1719 from statechannels/demo-sequence-diagram
geoknee Sep 15, 2023
339e7d3
rename to App
lalexgap Sep 15, 2023
a2ae3a0
Merge remote-tracking branch 'origin/main' into merge-main
lalexgap Sep 15, 2023
080ab49
Merge pull request #1724 from statechannels/merge-main
lalexgap Sep 15, 2023
e1cb139
update to latest block num
lalexgap Sep 15, 2023
12c9da5
Merge pull request #1725 from statechannels/update-block-num
lalexgap Sep 15, 2023
1046f98
Merge pull request #1708 from statechannels/fildev-frontend
lalexgap Sep 15, 2023
2fb1a0a
add brackets
lalexgap Sep 15, 2023
e502af0
don't use parseint
lalexgap Sep 15, 2023
2d5d5bc
don't use remainingfunds twice
lalexgap Sep 15, 2023
8d68810
Merge pull request #1728 from statechannels/fix-ui
lalexgap Sep 15, 2023
f8e8a5f
Get steps working correctly
lalexgap Sep 15, 2023
d8f0b8f
multiply by 100
lalexgap Sep 15, 2023
4678426
Merge pull request #1730 from statechannels/fix-ui-steps
lalexgap Sep 15, 2023
8a836f5
skip to payment step if we have a channel
lalexgap Sep 15, 2023
89e50d0
use amounts not addresses
geoknee Sep 15, 2023
42f410a
print short channel id
geoknee Sep 15, 2023
54390a7
remove local storage
lalexgap Sep 15, 2023
6206205
convert to number later
geoknee Sep 15, 2023
fb4ca52
Merge pull request #1731 from statechannels/handle-local-storage
lalexgap Sep 15, 2023
e0420b9
prevent division by zero
geoknee Sep 15, 2023
a19c3ba
try out using min and max API
geoknee Sep 15, 2023
9bac867
use non percentage mode
geoknee Sep 15, 2023
bc5aa31
Merge pull request #1732 from statechannels/ui-tweaks
lalexgap Sep 15, 2023
f96c131
Use the proxy rul env var
lalexgap Sep 15, 2023
00079f5
Merge pull request #1734 from statechannels/fix-proxy-url
lalexgap Sep 15, 2023
66ed368
Use correct env var
lalexgap Sep 15, 2023
b8720f4
update typing
lalexgap Sep 15, 2023
92b84f5
Merge pull request #1735 from statechannels/fix-proxy-url-really
lalexgap Sep 15, 2023
2f05ab0
Use known working file
lalexgap Sep 15, 2023
4b34f31
Merge pull request #1736 from statechannels/try-old-url
lalexgap Sep 15, 2023
fa35b3a
fix url
lalexgap Sep 15, 2023
7e363b4
Merge branch 'fix-url-2' into fildev-payment-client
lalexgap Sep 15, 2023
4ceb463
update data size
lalexgap Sep 15, 2023
e1b0776
avoid race condition
lalexgap Sep 15, 2023
08ed877
factor out copyright
geoknee Sep 18, 2023
014da34
fixmeup
geoknee Sep 18, 2023
01586a5
file relative path is env var
geoknee Sep 18, 2023
1c92c9e
insert some timers
geoknee Sep 18, 2023
06f425a
handle all responses
geoknee Sep 18, 2023
babe5cf
stop timer unconditionally
geoknee Sep 18, 2023
e154b15
proper "skip payment" state management
geoknee Sep 18, 2023
3a36ffe
move channel id into a chip in step 2
geoknee Sep 18, 2023
1d46468
move balances into step 2
geoknee Sep 18, 2023
c5e7d70
move bg to RHS
geoknee Sep 18, 2023
f4111d6
move error display into step 3
geoknee Sep 18, 2023
b96f0ad
combine link into copyright and add divider
geoknee Sep 18, 2023
561098d
fix typo and emphasize channel terminology
geoknee Sep 18, 2023
dcfc5b9
fix errs
geoknee Sep 18, 2023
b12e1f8
add favicon
geoknee Sep 18, 2023
718428f
fix incorrect timing
geoknee Sep 18, 2023
beef0de
shorten copyright text
geoknee Sep 18, 2023
ea941cc
Merge pull request #1738 from statechannels/refactor-demo-ui
lalexgap Sep 18, 2023
6e9f825
use no cache headers to avoid chrome caching file
lalexgap Sep 18, 2023
1e29807
update virtual funding to 200 gwei/nfil
lalexgap Sep 18, 2023
c03c6d8
Merge pull request #1746 from statechannels/update-virtual-balance
lalexgap Sep 18, 2023
c7e2b2f
Merge pull request #1743 from statechannels/avoid-cache
lalexgap Sep 18, 2023
616234f
swap slider for linear determinate progerss bar
geoknee Sep 19, 2023
add48b8
use a pair of progress bars
geoknee Sep 19, 2023
f7764a1
use prettyPrintPair
geoknee Sep 19, 2023
b61311a
remove unused import
geoknee Sep 19, 2023
e22630e
pretty print each balance
geoknee Sep 19, 2023
a1bb402
Merge pull request #1748 from statechannels/silder-progress
geoknee Sep 19, 2023
271eb74
Add install-mkcert-mac command and update tls readme
kerzhner Sep 15, 2023
2141764
log out payload
lalexgap Sep 18, 2023
5907c42
just log out all params
lalexgap Sep 18, 2023
208128f
correctly json name
lalexgap Sep 18, 2023
4911770
refactor create-channel
lalexgap Sep 18, 2023
402510f
rename to create-ledger-channel
lalexgap Sep 18, 2023
cd0c588
fix create-channels
lalexgap Sep 18, 2023
658c413
support uint64
lalexgap Sep 18, 2023
538695a
serve the file on every url
lalexgap Sep 18, 2023
cb90bd7
support multiple files in env var
lalexgap Sep 18, 2023
d2b5b66
add more files
lalexgap Sep 18, 2023
0e8ada9
Allow for the selection of multiple files
lalexgap Sep 18, 2023
d8bb390
rename to files
lalexgap Sep 18, 2023
bec3538
Merge pull request #1742 from statechannels/select-a-file
lalexgap Sep 19, 2023
ecbcb34
update destination url to digital ocean
lalexgap Sep 19, 2023
185bbdb
Use deployed files
lalexgap Sep 19, 2023
d78b0da
use different split env var
lalexgap Sep 19, 2023
eff444d
update data size
lalexgap Sep 19, 2023
4e7ebeb
support paying different amounts for a file
lalexgap Sep 19, 2023
b2eae40
Merge pull request #1756 from statechannels/use-deployed-files-2
lalexgap Sep 19, 2023
d146303
Merge pull request #1757 from statechannels/support-different-amounts
lalexgap Sep 19, 2023
1dce5dd
smaller payment channel budget
lalexgap Sep 19, 2023
6f45782
Merge pull request #1758 from statechannels/smaller-payment-channels
lalexgap Sep 19, 2023
75c44db
use custom file names
lalexgap Sep 19, 2023
a28ae9d
do not use row
lalexgap Sep 19, 2023
077002e
Add support for micropayments
lalexgap Sep 19, 2023
349c231
bigger chunks
lalexgap Sep 19, 2023
ca771b8
remove whitespace
lalexgap Sep 19, 2023
26bda94
support skipping micropayments
lalexgap Sep 19, 2023
5177363
update channel info so we see progress
lalexgap Sep 19, 2023
0255403
Merge pull request #1759 from statechannels/custom-filenames
lalexgap Sep 19, 2023
efcb35f
Add progress label
lalexgap Sep 20, 2023
ea2fd1d
use hardcoded filenames for downloaded file name
lalexgap Sep 20, 2023
08f032a
Merge pull request #1755 from statechannels/micro-payments
lalexgap Sep 20, 2023
0380828
updat channel info immediately when payment leaves client
geoknee Sep 20, 2023
3fd86b8
use arraybuffer instead of read
lalexgap Sep 20, 2023
664354e
Merge pull request #1772 from statechannels/nice-download-names
lalexgap Sep 20, 2023
095ea1d
Merge pull request #1762 from statechannels/snappier-payment-feedback
lalexgap Sep 20, 2023
1b85ad0
Merge remote-tracking branch 'origin/main' into update-with-main
lalexgap Sep 20, 2023
334dfdf
Merge pull request #1775 from statechannels/update-with-main
lalexgap Sep 20, 2023
12215c2
use the download button as the progress bar
geoknee Sep 20, 2023
17c0adf
fix err
geoknee Sep 20, 2023
9c450f6
remove comment
geoknee Sep 20, 2023
3f327f9
disable button while fetch in progress
lalexgap Sep 20, 2023
28534fe
reset progress at start
lalexgap Sep 20, 2023
a350de1
disable button when progress is 100
lalexgap Sep 20, 2023
cbc1974
Merge pull request #1778 from statechannels/ag-button-progress2
geoknee Sep 21, 2023
5e034a9
reverse direction of download progress button
geoknee Sep 21, 2023
e572762
Merge pull request #1780 from statechannels/reverse-button-colours
geoknee Sep 21, 2023
df05962
use open instead of clicking the link
lalexgap Sep 20, 2023
339365f
use blank target
lalexgap Sep 20, 2023
e9bd189
use window
lalexgap Sep 20, 2023
99cfec8
do not revoke url
lalexgap Sep 20, 2023
cb662cb
open a new tab and display the image as html
geoknee Sep 21, 2023
5b5cc5a
change dev flow to use procedural png file
geoknee Sep 21, 2023
244c029
use a modal instead of a new tab
geoknee Sep 21, 2023
85166ff
proxy server uses attoFIL units
geoknee Sep 21, 2023
150c513
display file cost on button
geoknee Sep 21, 2023
da05539
open filscan link in new tab
geoknee Sep 21, 2023
43132af
reword step 1
geoknee Sep 21, 2023
4967947
add DCENT link to step 2
geoknee Sep 21, 2023
89f0e3d
use CID paths and DCENT endpoint
geoknee Sep 21, 2023
8a020f3
add ACAO idempotently
geoknee Sep 21, 2023
ea089d6
add CORS headers to sample file server
geoknee Sep 21, 2023
e15e7ad
idempotently set ACAO header
geoknee Sep 21, 2023
1e774ee
update test expectation to match proxy server
geoknee Sep 21, 2023
91b37ab
Merge pull request #1782 from statechannels/dcent
geoknee Sep 21, 2023
36686df
Update packages/payment-proxy-client/src/App.tsx
geoknee Sep 21, 2023
e9ca247
Update packages/payment-proxy-client/src/App.tsx
geoknee Sep 21, 2023
085f604
Update packages/payment-proxy-client/src/App.tsx
geoknee Sep 21, 2023
f9c757a
make button less wide and center it
geoknee Sep 21, 2023
f972ab1
Merge pull request #1783 from statechannels/QA
geoknee Sep 21, 2023
9591c11
Merge pull request #1781 from statechannels/use-open
geoknee Sep 21, 2023
89636c3
add micropayment info icon
lalexgap Sep 21, 2023
0385cce
update link to sub block
geoknee Sep 21, 2023
88207e1
Merge pull request #1779 from statechannels/info-icon
geoknee Sep 21, 2023
ed344bd
prefer <Link> to <a>
geoknee Sep 21, 2023
cbf2030
Merge pull request #1787 from statechannels/links
lalexgap Sep 21, 2023
c208e3d
enable cors on error
lalexgap Sep 21, 2023
be7537a
tweak wording
lalexgap Sep 21, 2023
2e8cde4
Merge pull request #1788 from statechannels/fix-cors
lalexgap Sep 21, 2023
b331b2c
update config files to use new adjudicator
lalexgap Sep 21, 2023
d67ddd6
update link to use verified contract
lalexgap Sep 21, 2023
55c77dc
update consensus app
lalexgap Sep 21, 2023
d660c0b
update virtual payment app
lalexgap Sep 21, 2023
d62b51b
Merge pull request #1790 from statechannels/new-adjudicator
lalexgap Sep 21, 2023
e99f253
enhanced logging
lalexgap Sep 25, 2023
f86148c
typo
lalexgap Sep 25, 2023
166938d
Merge pull request #1793 from statechannels/better-logging
lalexgap Sep 25, 2023
add77a3
remove spurious bootpeers
geoknee Oct 9, 2023
6f04e00
remove unused line
geoknee Oct 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions .github/workflows/deploy-cloud-nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ on:
workflow_dispatch:
inputs:
build-image:
description: 'Build docker image'
description: "Build docker image"
required: false
default: 'true'
default: "true"
deploy-iris:
description: 'Deploy Iris'
description: "Deploy Iris"
required: false
default: 'true'
default: "true"
deploy-anthony:
description: 'Deploy Anthony'
description: "Deploy Anthony"
required: false
default: 'true'
default: "true"
deploy-brad:
description: 'Deploy Brad'
description: "Deploy Brad"
required: false
default: 'true'
default: "true"

jobs:
build-image:
Expand Down Expand Up @@ -53,9 +53,9 @@ jobs:
SSH_PRIVATE_KEY: ${{ secrets.IRIS_SSH_PRIVATE_KEY }}
SC_PK: ${{ secrets.IRIS_SC_PK }}
CHAIN_PK: ${{ secrets.IRIS_CHAIN_PK }}
NITRO_CONFIG_PATH: './nitro_config/iris.toml'
DROPLET_IP: '67.207.88.72'
NODE_NAME: 'nitro_iris'
NITRO_CONFIG_PATH: "./nitro_config/iris.toml"
DROPLET_IP: "67.207.88.72"
NODE_NAME: "nitro_iris"
run: |
echo "$SSH_PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
Expand All @@ -71,6 +71,7 @@ jobs:
-e SC_PK=$SC_PK \
-e CHAIN_PK=$CHAIN_PK \
-v /var/nitro_store:/app/data \
-v /etc/letsencrypt:/app/certs \
registry.digitalocean.com/magmo/go-nitro:latest
ENDSSH
rm private_key.pem
Expand All @@ -87,9 +88,9 @@ jobs:
SSH_PRIVATE_KEY: ${{ secrets.ANTHONY_SSH_PRIVATE_KEY }}
SC_PK: ${{ secrets.ANTHONY_SC_PK }}
CHAIN_PK: ${{ secrets.ANTHONY_CHAIN_PK }}
NITRO_CONFIG_PATH: './nitro_config/anthony.toml'
DROPLET_IP: '134.122.114.102'
NODE_NAME: 'nitro_anthony'
NITRO_CONFIG_PATH: "./nitro_config/anthony.toml"
DROPLET_IP: "134.122.114.102"
NODE_NAME: "nitro_anthony"
run: |
echo "$SSH_PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
Expand All @@ -105,6 +106,7 @@ jobs:
-e SC_PK=$SC_PK \
-e CHAIN_PK=$CHAIN_PK \
-v /var/nitro_store:/app/data \
-v /etc/letsencrypt:/app/certs \
registry.digitalocean.com/magmo/go-nitro:latest
ENDSSH
rm private_key.pem
Expand All @@ -121,9 +123,9 @@ jobs:
SSH_PRIVATE_KEY: ${{ secrets.BRAD_SSH_PRIVATE_KEY }}
SC_PK: ${{ secrets.BRAD_SC_PK }}
CHAIN_PK: ${{ secrets.BRAD_CHAIN_PK }}
NITRO_CONFIG_PATH: './nitro_config/brad.toml'
DROPLET_IP: '192.81.214.172'
NODE_NAME: 'nitro_brad'
NITRO_CONFIG_PATH: "./nitro_config/brad.toml"
DROPLET_IP: "192.81.214.172"
NODE_NAME: "nitro_brad"
run: |
echo "$SSH_PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
Expand All @@ -139,6 +141,7 @@ jobs:
-e SC_PK=$SC_PK \
-e CHAIN_PK=$CHAIN_PK \
-v /var/nitro_store:/app/data \
-v /etc/letsencrypt:/app/certs \
registry.digitalocean.com/magmo/go-nitro:latest
ENDSSH
rm private_key.pem
23 changes: 15 additions & 8 deletions .github/workflows/deploy-patsy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
workflow_dispatch:
inputs:
build-image:
description: 'Build docker image'
description: "Build docker image"
required: false
default: 'true'
default: "true"
deploy-patsy:
description: 'Deploy Patsy'
description: "Deploy Patsy"
required: false
default: 'true'
default: "true"

jobs:
build-image:
Expand Down Expand Up @@ -43,10 +43,13 @@ jobs:
env:
DO_API_KEY: ${{ secrets.DO_API_KEY }}}
SSH_PRIVATE_KEY: ${{ secrets.PATSY_SSH_PRIVATE_KEY }}
DROPLET_IP: '165.22.197.200'
NAME: 'nitro-payment-proxy'
NITRO_ENDPOINT: 'brad-node.statechannels.org:4005/api/v1'
DESTINATION_URL: 'https://magmo.com'
DROPLET_IP: "165.22.197.200"
NAME: "nitro-payment-proxy"
NITRO_ENDPOINT: "brad-node.statechannels.org:4005/api/v1"
DESTINATION_URL: "https://core8.datasetcreators.com/"
TLS_CERT_FILE: /app/certs/live/payment-proxy.statechannels.org/fullchain.pem
TLS_KEY_FILE: /app/certs/live/payment-proxy.statechannels.org/privkey.pem
PROXY_PORT: 443
run: |
echo "$SSH_PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
Expand All @@ -56,9 +59,13 @@ jobs:
docker stop $NAME || true
docker rm $NAME || true
docker run --restart=unless-stopped -it -d --name $NAME \
-v /etc/letsencrypt:/app/certs \
-p 443:443 -p 80:80 -p 5511:5511 \
-e NITRO_ENDPOINT=$NITRO_ENDPOINT \
-e DESTINATION_URL=$DESTINATION_URL \
-e TLS_CERT_FILE=$TLS_CERT_FILE \
-e TLS_KEY_FILE=$TLS_KEY_FILE \
-e PROXY_PORT=$PROXY_PORT \
registry.digitalocean.com/magmo/nitro-payment-proxy:latest
ENDSSH
rm private_key.pem
63 changes: 35 additions & 28 deletions cmd/sample-file-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package main

import (
"fmt"
"image"
"image/color"
"image/png"
"log"
"math/rand"
"net/http"
"os"
"os/signal"
Expand All @@ -29,12 +31,7 @@ func main() {
Value: 8088,
Aliases: []string{"p"},
},
&cli.StringFlag{
Name: FILE_URL,
Usage: "Specifies the url to serve the file at.",
Value: "/test.txt",
Aliases: []string{"f"},
},

&cli.UintFlag{
Name: FILE_LENGTH,
Usage: "Specifies the length of the file to serve.",
Expand All @@ -44,17 +41,22 @@ func main() {
},
Action: func(c *cli.Context) error {
const (
fileName = "test.txt"
fileName = "test.png"
)

fileContent := generateFileData(c.Int(FILE_LENGTH))
filePath, cleanup := setupFile(fileName, fileContent)
defer cleanup()

http.HandleFunc(c.String(FILE_URL), func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// Set the Content-Disposition header to suggest a filename
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", fileName))

// Add CORS headers to allow all origins (*).
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Expose-Headers", "*")

http.ServeFile(w, r, filePath)
})

Expand All @@ -81,7 +83,7 @@ func waitForKillSignal() {
}

// setupFile creates a file with the given name and content, and returns a cleanup function
func setupFile(fileName string, fileContent string) (string, func()) {
func setupFile(fileName string, fileContent *image.RGBA) (string, func()) {
dataFolder, err := os.MkdirTemp("", "sample-file-server-*")
if err != nil {
panic(err)
Expand All @@ -94,11 +96,12 @@ func setupFile(fileName string, fileContent string) (string, func()) {
}
defer file.Close()

_, err = file.WriteString(fileContent)
if err != nil {
if err := png.Encode(file, fileContent); err != nil {
fmt.Println("Failed to encode image:", err)
os.Remove(filePath)
panic(err)
}

return filePath, func() {
err := os.Remove(fileName)
if err != nil {
Expand All @@ -108,22 +111,26 @@ func setupFile(fileName string, fileContent string) (string, func()) {
}

// generateFileData generates a string of the given length composed of random words
func generateFileData(length int) (fileData string) {
if length < 10 {
panic("file length must be at least 10")
}
wordSelection := []string{
"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel",
"India", "Juliet", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa",
"Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey",
"X-ray", "Yankee", "Zulu",
}
fileData = "START"
// Continue adding words until we reach the desired length or beyond
for len(fileData) < length {
randomIndex := rand.Intn(len(wordSelection))
fileData = fileData + " " + wordSelection[randomIndex]
func generateFileData(length int) (img *image.RGBA) {
// Define image dimensions
width, height := length, length

// Create an empty RGBA image
img = image.NewRGBA(image.Rect(0, 0, width, height))

// Fill the image with a gradient
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
// Gradient: Horizontal red, Vertical blue
c := color.RGBA{
R: uint8(x * 255 / width),
B: uint8(y * 255 / height),
G: 0,
A: 255, // Fully opaque
}
img.Set(x, y, c)
}
}

return fileData[:length-3] + "END"
return img
}
15 changes: 15 additions & 0 deletions cmd/start-payment-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const (
PROXY_ADDRESS = "proxyaddress"
DESTINATION_URL = "destinationurl"
COST_PER_BYTE = "costperbyte"

TLS_CERT_FILEPATH = "tlscertfilepath"
TLS_KEY_FILEPATH = "tlskeyfilepath"
)

func main() {
Expand Down Expand Up @@ -48,6 +51,16 @@ func main() {
Value: 1,
Aliases: []string{"c"},
},
&cli.StringFlag{
Name: TLS_CERT_FILEPATH,
Usage: "Filepath to the TLS certificate. If not specified, TLS will not be used.",
Value: "",
},
&cli.StringFlag{
Name: TLS_KEY_FILEPATH,
Usage: "Filepath to the TLS private key. If not specified, TLS will not be used.",
Value: "",
},
},
Action: func(c *cli.Context) error {
proxyEndpoint := c.String(PROXY_ADDRESS)
Expand All @@ -60,6 +73,8 @@ func main() {
nitroEndpoint,
c.String(DESTINATION_URL),
c.Uint64(COST_PER_BYTE),
c.String(TLS_CERT_FILEPATH),
c.String(TLS_KEY_FILEPATH),
)

return proxy.Start()
Expand Down
11 changes: 7 additions & 4 deletions docker/nitro/anthony.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ pk = ""
# Chain Public Address: 0x56032FA02b2592338b9A42B1865d5a5BEEaF2B75
chainpk = ""

naaddress = "0xe32d4B5C5a80660710f6a2aD3cB1c11664138F34"
vpaaddress = "0x4D1a804e1cE383D75032C52878553212992C98D7"
caaddress = "0x0C9D79725afc344A388045235CD0B23eA4f0E838"
naaddress = "0xe1790ea824035184a3bf344e087fb61744992545"
vpaaddress = "0x95EfacCb38106C249F5ddC25b71677d5aF6d31A0"
caaddress = "0xe1790ea824035184a3bf344e087fb61744992545"

# RPC provider docs: https://lotus.filecoin.io/lotus/developers/glif-nodes/#testnet-endpoint
chainurl = "wss://wss.calibration.node.glif.io/apigw/lotus/rpc/v0"
chainstartblock = 909569
chainstartblock = 915929
chainauthtoken = ""

bootpeers = "/ip4/67.207.88.72/tcp/3005/p2p/16Uiu2HAmDQj9XnHPD1d4GzS1K3DhmM5Z1cSGLfVTwVcNVdEsAN3Q"

tlscertfilepath = "/app/certs/live/anthony-node.statechannels.org/fullchain.pem"
tlskeyfilepath = "/app/certs/live/anthony-node.statechannels.org/privkey.pem"
11 changes: 7 additions & 4 deletions docker/nitro/brad.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ pk = ""
# Chain Public Address: 0xB62da17fab129AD3DF8858B7B1a834e570b8eead
chainpk = ""

naaddress = "0xe32d4B5C5a80660710f6a2aD3cB1c11664138F34"
vpaaddress = "0x4D1a804e1cE383D75032C52878553212992C98D7"
caaddress = "0x0C9D79725afc344A388045235CD0B23eA4f0E838"
naaddress = "0xe1790ea824035184a3bf344e087fb61744992545"
vpaaddress = "0x95EfacCb38106C249F5ddC25b71677d5aF6d31A0"
caaddress = "0xe1790ea824035184a3bf344e087fb61744992545"

# RPC provider docs: https://lotus.filecoin.io/lotus/developers/glif-nodes/#testnet-endpoint
chainurl = "wss://wss.calibration.node.glif.io/apigw/lotus/rpc/v0"
chainstartblock = 909569
chainstartblock = 915929
chainauthtoken = ""

bootpeers = "/ip4/67.207.88.72/tcp/3005/p2p/16Uiu2HAmDQj9XnHPD1d4GzS1K3DhmM5Z1cSGLfVTwVcNVdEsAN3Q"

tlscertfilepath = "/app/certs/live/brad-node.statechannels.org/fullchain.pem"
tlskeyfilepath = "/app/certs/live/brad-node.statechannels.org/privkey.pem"
11 changes: 7 additions & 4 deletions docker/nitro/iris.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ pk = ""
# Chain Public Address: 0x16e43DDc5FE417046Da7A0C469cCD4DE6b4764fA
chainpk = ""

naaddress = "0xe32d4B5C5a80660710f6a2aD3cB1c11664138F34"
vpaaddress = "0x4D1a804e1cE383D75032C52878553212992C98D7"
caaddress = "0x0C9D79725afc344A388045235CD0B23eA4f0E838"
naaddress = "0xe1790ea824035184a3bf344e087fb61744992545"
vpaaddress = "0x95EfacCb38106C249F5ddC25b71677d5aF6d31A0"
caaddress = "0xe1790ea824035184a3bf344e087fb61744992545"

# RPC provider docs: https://lotus.filecoin.io/lotus/developers/glif-nodes/#testnet-endpoint
chainurl = "wss://wss.calibration.node.glif.io/apigw/lotus/rpc/v0"
chainstartblock = 908130
chainstartblock = 915929
chainauthtoken = ""

bootpeers = ""

tlscertfilepath = "/app/certs/live/iris-node.statechannels.org/fullchain.pem"
tlskeyfilepath = "/app/certs/live/iris-node.statechannels.org/privkey.pem"
6 changes: 4 additions & 2 deletions docker/paymentproxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.21-bullseye AS builder
WORKDIR /app
COPY . .
COPY ./docker/local/config.toml .

RUN go build -o proxy ./cmd/start-payment-proxy

FROM debian:bullseye-slim
Expand All @@ -16,6 +16,8 @@ ENV PROXY_PORT=5511
ENV NITRO_ENDPOINT=host.docker.internal:4007/api/v1
ENV DESTINATION_URL=http://host.docker.internal:8088
ENV COST_PER_BYTE=1
ENV TLS_CERT_FILE=""
ENV TLS_KEY_FILE=""

EXPOSE $PROXY_PORT
CMD ./proxy --nitroendpoint $NITRO_ENDPOINT --proxyaddress 0.0.0.0:$PROXY_PORT --destinationurl $DESTINATION_URL --costperbyte $COST_PER_BYTE
CMD ./proxy --nitroendpoint $NITRO_ENDPOINT --proxyaddress 0.0.0.0:$PROXY_PORT --destinationurl $DESTINATION_URL --costperbyte $COST_PER_BYTE --tlscertfilepath $TLS_CERT_FILE --tlskeyfilepath $TLS_KEY_FILE
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,13 @@ func main() {
if err != nil {
return err
}
var cert tls.Certificate

cert, err := tls.LoadX509KeyPair(tlsCertFilepath, tlsKeyFilepath)
if err != nil {
panic(err)
if tlsCertFilepath != "" && tlsKeyFilepath != "" {
cert, err = tls.LoadX509KeyPair(tlsCertFilepath, tlsKeyFilepath)
if err != nil {
panic(err)
}
}

rpcServer, err := rpc.InitializeRpcServer(node, rpcPort, useNats, &cert)
Expand Down
Loading