在开发后端服务时, APP中已经写好了服务器地址, 如何在本地开发机器调试呢? 首先,需要设置本地机器的hosts。 最方便的工具是gas masks https://github.com/2ndalpha/gasmask
添加类似如下代码
127.0.0.1 dev.example.com
生成本地证书 copy default OpenSSL config
| ./jaeger-collector --collector.zipkin.http-port=9411 \ | |
| --span-storage.type kafka \ | |
| --kafka.producer.authentication=tls \ | |
| --kafka.producer.tls.ca=/home/rvargasp/kafka_2.12-2.2.1/config/ssl/ca-cert \ | |
| --kafka.producer.tls.cert=/home/rvargasp/kafka_2.12-2.2.1/config/ssl/cert-client-signed \ | |
| --kafka.producer.tls.key=/home/rvargasp/kafka_2.12-2.2.1/config/ssl/client_key.pem \ | |
| --kafka.producer.brokers=kafka:9093 \ | |
| --kafka.producer.topic=jaeger \ | |
| --kafka.producer.encoding=json |
在开发后端服务时, APP中已经写好了服务器地址, 如何在本地开发机器调试呢? 首先,需要设置本地机器的hosts。 最方便的工具是gas masks https://github.com/2ndalpha/gasmask
添加类似如下代码
127.0.0.1 dev.example.com
生成本地证书 copy default OpenSSL config
Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".
Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).
Let's dig in:
🚨 2020 Update: I recommend using mkcert to generate local certificates. You can do everything below by just running the commands brew install mkcert and mkcert -install. Keep it simple!
This gives you that beautiful green lock in Chrome. I'm assuming you're putting your SSL documents in /etc/ssl, but you can put them anywhere and replace the references in the following commands. Tested successfully on Mac OS Sierra and High Sierra.
sudo nano /etc/ssl/localhost/localhost.conf
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "os/signal" | |
| "syscall" | |
| ) |
| local char_to_hex = function(c) | |
| return string.format("%%%02X", string.byte(c)) | |
| end | |
| local function urlencode(url) | |
| if url == nil then | |
| return | |
| end | |
| url = url:gsub("\n", "\r\n") | |
| url = url:gsub("([^%w ])", char_to_hex) |
| package main | |
| import ( | |
| "flag" | |
| "io" | |
| "log" | |
| "net" | |
| "net/http" | |
| "strings" | |
| ) |
| git diff --name-only --cached --diff-filter=ACMRTUXB | while read filename; do php-cs-fixer --level=symfony fix $filename; done; |
| <?php namespace App\Providers; | |
| use Illuminate\Support\ServiceProvider; | |
| /** | |
| * If the incoming request is an OPTIONS request | |
| * we will register a handler for the requested route | |
| */ | |
| class CatchAllOptionsRequestsProvider extends ServiceProvider { |
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)