Merge pull request 'improved sinking' (#17) from wgtun into develop
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #17
This commit is contained in:
commit
492cf40653
@ -52,7 +52,11 @@ func (t *SourceSink) Source() (proxy.Packet, error) {
|
|||||||
var good, bad float64
|
var good, bad float64
|
||||||
|
|
||||||
func (t *SourceSink) Sink(packet proxy.Packet) error {
|
func (t *SourceSink) Sink(packet proxy.Packet) error {
|
||||||
_, err := t.tun.Write(packet.Contents(), 4)
|
// make space for tun header
|
||||||
|
content := make([]byte, len(packet.Contents())+4)
|
||||||
|
copy(content[4:], packet.Contents())
|
||||||
|
|
||||||
|
_, err := t.tun.Write(content, 4)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
case *os.PathError:
|
case *os.PathError:
|
||||||
|
Loading…
Reference in New Issue
Block a user