3 ms·
Someone’s already got it working on macOS: https://twitter.com/saurik/status/1176893448445558784 https://twitter.com/saurik/status/1176893448445558784
by trollied 7y ago
Someone’s already got it working on macOS: https://twitter.com/saurik/status/1176893448445558784 https://twitter.com/saurik/status/1176893448445558784
- OJFord 7y agoFast work indeed, the meat of it: (registering a `wg` generated public key with CF) api=https://api.cloudflareclient.com/v0i1909051800 ins() { vrb=$1; shift; curl -s -H 'user-agent:' -H 'content-type: application/json' -X "${vrb}" "${api}/$@"; } sec() { ins "$@" -H 'authorization: Bearer '"${reg[1]}"''; } cfg=($(if [[ -e "${usr}" ]]; then reg=($(cat "${usr}")) test "${#reg[@]}" -eq 2 sec GET "reg/${reg[0]}" else reg=($(ins POST "reg" -d '{"install_id":"","tos":"'"$(date -u +%FT%T.000Z)"'","key":"'"${pub}"'","fcm_token":"","type":"ios","locale":"en_US"}' | jq -r '.result|.id+" "+.token')) test "${#reg[@]}" -eq 2 echo "${reg[@]}" >"${usr}" sec PATCH "reg/${reg[0]}" -d '{"warp_enabled":true}' fi | jq -r '.result.config|(.peers[0]|.public_key+" "+.endpoint.v4)+" "+.interface.addresses.v4')) test "${#cfg[@]}" -eq 3