macronut / ghostcp

GhosTCP is a program for Windows that protects the TCP connections from being interfered.
GNU Lesser General Public License v3.0
837 stars 164 forks source link

build error undefined: godivert.WinDivertOpen #5

Closed Lyoko-Jeremie closed 4 years ago

Lyoko-Jeremie commented 4 years ago

build with command go build main.go

# _/TCPioneer/header
header\tcp.go:89:20: undefined: godivert.WinDivertOpen   
header\tcp.go:415:20: undefined: godivert.WinDivertOpen  
header\tcp.go:922:20: undefined: godivert.WinDivertOpen  
header\udp.go:374:20: undefined: godivert.WinDivertOpen  

and i can see , the godivert changed the func sig as

func NewWinDivertHandleWithFlags(filter string, flags uint8) (*WinDivertHandle, error) {

https://github.com/williamfhe/godivert/blob/a48c5b872c736d3f23abaad7732528b17416341a/windivert.go#L65

i think this case by a old version on @Macronut 's deps, or you changed the williamfhe/godivert libs ?

i read the windivert-doc , i think it can be fix as https://github.com/Lyoko-Jeremie/TCPioneer/commit/0f42d6335383cb860cacd621d8b6956ccc02a13e if not use any advance godivert's feature.

from:

    winDivert, err := godivert.WinDivertOpen(filter, layer, 1, 0)

to:

    winDivert, err := godivert.NewWinDivertHandle(filter)
    _ = layer

i checked the layer always be 0 or 1 , the doc tell me it seems like same in this times. and the priority flag seems set for debug, i dont know it meas or effect.

BTW: maybe we need make a PR to add a full sig func on the williamfhe/godivert lib ?

macronut commented 4 years ago

This is a small change, because I need set other parameters https://github.com/Macronut/godivert/blob/master/windivert.go