Task Description: Implement Certificate Signing and Verification
You are required to implement the necessary functions and structures to enable certificate signing and verification in the Go package goproxy. This functionality should fulfill the requirements outlined in the existing unit tests (TestSingerTls and TestSingerX509).
Requirements:
Certificate Authority (CA) Structure:
Define a CA structure to hold the details of the GoproxyCa which should include the private key and the leaf certificate.
The structure should support the creation and signing of new certificates.
Implement this function to generate a certificate for the given hosts using the specified certificate authority (CA).
The function should return a newly signed certificate and handle any errors appropriately.
Certificate Verification:
Ensure that the created certificate can be verified against the CA.
Implement the functionality to check if the certificate's signature matches the CA's signature.
TLS Server Setup:
Make sure that the created certificate can be used to configure a TLS server, responding correctly to HTTP requests.
Get Browser Functionality:
The getBrowser function should accurately retrieve the browser argument from command line arguments, allowing the tests to launch a browser when specified.
Tests:
Ensure that both TestSingerTls and TestSingerX509 pass successfully after implementing the requested features.
Place the implemented code in the /app/ directory within the Go project structure. Your solution should adhere to Go's conventions and styles. Include appropriate import statements and ensure that all dependencies are handled correctly.
Important: declare your solution in package goproxy (the test file uses package goproxy, so the implementation must use the matching package name).