Skip to content

Instantly share code, notes, and snippets.

View calmh's full-sized avatar
:bowtie:
I may be slow to respond.

Jakob Borg calmh

:bowtie:
I may be slow to respond.
View GitHub Profile
#!/usr/bin/env python
import sys
import socket
hex = ""
for line in sys.stdin.readlines():
first_space = line.index(' ')
if first_space > 2:
line = line[first_space:]
package main
import (
"bufio"
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"net"
@calmh
calmh / -
Created September 7, 2016 11:55
config/bgp_configs.go | 6 ++++
packet/bgp/bgp.go | 76 +++++++++++++++++++++++++++++++++++++++-----------
packet/bgp/bgp_test.go | 35 ++++++++++++++++++++++-
3 files changed, 99 insertions(+), 18 deletions(-)
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index 7125db4..c99342b 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -83,6 +83,7 @@ const (
@calmh
calmh / -
Created August 19, 2016 07:20
jb@syno:~ $ syncthing -home /Volumes/Untitled
[monitor] 09:20:39 INFO: Starting syncthing
[start] 09:20:39 INFO: Generating ECDSA key and certificate for syncthing...
[XE7ET] 09:20:39 INFO: syncthing v0.14.4+18-g7f5bb04-dirty-pr-3489 "Dysprosium Dragonfly" (go1.7rc6 darwin-amd64) [email protected] 2016-08-18 18:53:55 UTC
[XE7ET] 09:20:39 INFO: My ID: XE7ET75-XUA3TYO-VQGD5V2-FE2KBS3-2MWLBUP-NLVHHYM-I5HCCWV-EM3A6QW
[XE7ET] 09:20:40 INFO: Single thread hash performance is ~374 MB/s
[XE7ET] 09:20:40 INFO: Default folder created and/or linked to new config
[XE7ET] 09:20:40 FATAL: get free port (BEP/kcp): listen udp 0.0.0.0:0: unexpected address type 0.0.0.0:0
[monitor] 09:20:40 INFO: Syncthing exited: exit status 1
@calmh
calmh / -
Created August 18, 2016 21:02
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4cc1d7]
goroutine 116 [running]:
panic(0x624860, 0xc4200120a0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/syncthing/syncthing/vendor/github.com/ccding/go-stun/stun.(*Client).Keepalive(0xc420825cc8, 0xc420462000, 0x0, 0x1)
/Users/jb/src/github.com/syncthing/syncthing/vendor/github.com/ccding/go-stun/stun/client.go:122 +0xe7
github.com/syncthing/syncthing/lib/connections.(*kcpListener).stunRenewal(0xc4211a4100, 0xb631c0, 0xc4219d2380)
/Users/jb/src/github.com/syncthing/syncthing/lib/connections/kcp_listen.go:237 +0x85a
@calmh
calmh / -
Created August 18, 2016 21:01
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4cc1d7]
goroutine 116 [running]:
panic(0x624860, 0xc4200120a0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/syncthing/syncthing/vendor/github.com/ccding/go-stun/stun.(*Client).Keepalive(0xc420825cc8, 0xc420462000, 0x0, 0x1)
/Users/jb/src/github.com/syncthing/syncthing/vendor/github.com/ccding/go-stun/stun/client.go:122 +0xe7
github.com/syncthing/syncthing/lib/connections.(*kcpListener).stunRenewal(0xc4211a4100, 0xb631c0, 0xc4219d2380)
/Users/jb/src/github.com/syncthing/syncthing/lib/connections/kcp_listen.go:237 +0x85a
@calmh
calmh / -
Created August 18, 2016 20:16
jb@syno:~/tmp $ go run foo.go
2016/08/18 22:15:42 Do Test1
2016/08/18 22:15:42 Send To: 217.10.68.152:3478
2016/08/18 22:15:42 Received: {packet nil: false, local: 213.114.6.177:9237, remote: 217.10.68.152:3478, changed: 217.116.122.136:3479, identical: false}
2016/08/18 22:15:42 Do Test2
2016/08/18 22:15:42 Send To: 217.10.68.152:3478
2016/08/18 22:15:52 Received: Nil
2016/08/18 22:15:52 Do Test1
2016/08/18 22:15:52 Send To: 217.116.122.136:3479
2016/08/18 22:15:52 Received: {packet nil: false, local: 213.114.6.177:21548, remote: 217.116.122.136:3479, changed: 217.10.68.152:3478, identical: false}
@calmh
calmh / -
Created August 18, 2016 20:12
[root@acro-syncer /home/jb]# ./foo
2016/08/18 22:05:33 Do Test1
2016/08/18 22:05:33 Send To: 217.10.68.152:3478
2016/08/18 22:05:33 Received: {packet nil: false, local: 194.126.249.11:44444, remote: 217.10.68.152:3478, changed: 217.116.122.138:3479, identical: false}
2016/08/18 22:05:33 Do Test2
2016/08/18 22:05:33 Send To: 217.10.68.152:3478
2016/08/18 22:05:43 Received: Nil
2016/08/18 22:05:43 Do Test1
2016/08/18 22:05:43 Send To: 217.116.122.138:3479
2016/08/18 22:05:43 Received: {packet nil: false, local: 194.126.249.11:44444, remote: 217.116.122.138:3479, changed: 217.10.68.152:3478, identical: false}
@calmh
calmh / -
Created August 18, 2016 20:06
[root@acro-syncer /home/jb]# ./foo
2016/08/18 22:05:33 Do Test1
2016/08/18 22:05:33 Send To: 217.10.68.152:3478
2016/08/18 22:05:33 Received: {packet nil: false, local: 194.126.249.11:44444, remote: 217.10.68.152:3478, changed: 217.116.122.138:3479, identical: false}
2016/08/18 22:05:33 Do Test2
2016/08/18 22:05:33 Send To: 217.10.68.152:3478
2016/08/18 22:05:43 Received: Nil
2016/08/18 22:05:43 Do Test1
2016/08/18 22:05:43 Send To: 217.116.122.138:3479
2016/08/18 22:05:43 Received: {packet nil: false, local: 194.126.249.11:44444, remote: 217.116.122.138:3479, changed: 217.10.68.152:3478, identical: false}
@calmh
calmh / -
Created August 18, 2016 19:38
jb@syno:~/tmp $ go run foo.go
Port restricted NAT 213.114.6.177:27618 <nil>
jb@hlv-srx240> show security flow session source-port 44444
Session ID: 46185, Policy name: trust-to-untrust/4, Timeout: 52, Valid
In: 172.16.32.182/44444 --> 217.116.122.136/3479;udp, If: vlan.100, Pkts: 1, Bytes: 72
Out: 217.116.122.136/3479 --> 213.114.6.177/22805;udp, If: vlan.200, Pkts: 1, Bytes: 116
Session ID: 46318, Policy name: trust-to-untrust/4, Timeout: 60, Valid