Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcap support #48

Merged
merged 7 commits into from
Jul 26, 2021
Merged

pcap support #48

merged 7 commits into from
Jul 26, 2021

Conversation

karupanerura
Copy link
Contributor

@karupanerura karupanerura commented Jul 24, 2021

please see readme for details.

Remaining issues

  • ✅ can't cross-compile anymore.
    • github.com/google/gopacket is required to parse pcap file
      • it depends on libpcap and PF-RING
      • so it needs CGO
    • resolved by 8226c64
  • --pos options is not yet supported
    • documented

@tkuchiki
Copy link
Owner

Thank you for your contribution!
I will check it.

@karupanerura
Copy link
Contributor Author

karupanerura commented Jul 26, 2021

NOTE:
The cross-build issue may be solved by using pcapgo.

@karupanerura
Copy link
Contributor Author

$ go build -a -tags netgo -installsuffix netgo -o alp ./cli/alp
$ ldd alp
        not a dynamic executable

resolved cross-compile issue by 8226c64

@karupanerura karupanerura marked this pull request as ready for review July 26, 2021 11:42
parsers/pcap.go Outdated Show resolved Hide resolved
parsers/pcap.go Outdated Show resolved Hide resolved
Copy link
Owner

@tkuchiki tkuchiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tkuchiki
Copy link
Owner

@karupanerura Is it okay to merge this PR?

@karupanerura
Copy link
Contributor Author

ah! plz wait a moment. I'll fixed #49 now.

}
u.RawQuery = values.Encode()
} else {
u.RawQuery = u.Query().Encode() // re-encode to sort queries
Copy link
Contributor Author

@karupanerura karupanerura Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found out that Encode can sort query parameters.
https://pkg.go.dev/net/url#Values.Encode

Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key.

https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/net/url/url.go;l=972

@karupanerura
Copy link
Contributor Author

@tkuchiki All done!

@tkuchiki
Copy link
Owner

Thanks!
I will review it again.

Copy link
Owner

@tkuchiki tkuchiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tkuchiki tkuchiki merged commit 56c55b1 into tkuchiki:main Jul 26, 2021
@tkuchiki
Copy link
Owner

@karupanerura Thank you so much!
I will release it v1.0.6 after some fixes, so please wait for a little while longer.

@karupanerura karupanerura deleted the feature/pcap branch July 26, 2021 13:02
@karupanerura
Copy link
Contributor Author

OK. Thank you!

@tkuchiki
Copy link
Owner

@karupanerura v1.0.6 has been released 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants