jackpal / gateway

A golang library for discovering the address of a LAN gateway.
BSD 3-Clause "New" or "Revised" License
226 stars 69 forks source link

Make Windows route print parsing more robust (fixes #5) #6

Closed calmh closed 8 years ago

calmh commented 8 years ago

This breaks out the parsing into a separate function for testing, and subjects it to some forms of invalid data. Also simplifies the "read all output" from route print step.

jackpal commented 8 years ago

Good in principle, but this is still Windows-specific code. Therefore the names should follow the naming pattern:

route_windows.go route_windows_test.go

Note that the underscore character has a special meaning in Go source file names, it's used for conditional compilation. (So _windows files are only compiled on Windows and _test files are only compiled on _test machines.)

The reason I suggest the name route is that this is a utility method for parsing the output of the Windows route command.

calmh commented 8 years ago

While that's of course correct, it means I would not be able to write or run this test as I develop on Mac. Hence the move out to the _common file.

aviau commented 8 years ago

@jackpal Any news on this?

I would like to see this merged in order to avoid shipping @calmh's fork of gateway in Debian.

jackpal commented 8 years ago

Sorry, got busy with other stuff. Your argument about cross-platform development sounds reasonable.

aviau commented 8 years ago

Thank you!