@@ -12,14 +12,17 @@ import (
12
12
"github.com/lightningnetwork/lnd/lntest/wait"
13
13
)
14
14
15
- type hashmailHarness struct {
16
- aperture * aperture.Aperture
17
- apertureCfg * aperture.Config
15
+ type HashmailHarness struct {
16
+ aperture * aperture.Aperture
17
+
18
+ // ApertureCfg is the configuration aperture uses when being initialized.
19
+ ApertureCfg * aperture.Config
18
20
}
19
21
20
- func newHashmailHarness () * hashmailHarness {
21
- return & hashmailHarness {
22
- apertureCfg : & aperture.Config {
22
+ // NewHashmailHarness creates a new instance of the HashmailHarness.
23
+ func NewHashmailHarness () * HashmailHarness {
24
+ return & HashmailHarness {
25
+ ApertureCfg : & aperture.Config {
23
26
ListenAddr : fmt .Sprintf ("127.0.0.1:%d" ,
24
27
node .NextAvailablePort ()),
25
28
Authenticator : & aperture.AuthConfig {
@@ -39,8 +42,8 @@ func newHashmailHarness() *hashmailHarness {
39
42
}
40
43
41
44
// initAperture starts the aperture proxy.
42
- func (hm * hashmailHarness ) initAperture () error {
43
- hm .aperture = aperture .NewAperture (hm .apertureCfg )
45
+ func (hm * HashmailHarness ) initAperture () error {
46
+ hm .aperture = aperture .NewAperture (hm .ApertureCfg )
44
47
errChan := make (chan error )
45
48
46
49
if err := hm .aperture .Start (errChan ); err != nil {
@@ -60,7 +63,7 @@ func (hm *hashmailHarness) initAperture() error {
60
63
}
61
64
return wait .NoError (func () error {
62
65
apertureAddr := fmt .Sprintf ("https://%s/dummy" ,
63
- hm .apertureCfg .ListenAddr )
66
+ hm .ApertureCfg .ListenAddr )
64
67
65
68
resp , err := http .Get (apertureAddr )
66
69
if err != nil {
@@ -75,14 +78,16 @@ func (hm *hashmailHarness) initAperture() error {
75
78
}, 3 * time .Second )
76
79
}
77
80
78
- func (hm * hashmailHarness ) start () error {
81
+ // Start attempts to start the aperture proxy.
82
+ func (hm * HashmailHarness ) Start () error {
79
83
if err := hm .initAperture (); err != nil {
80
84
return fmt .Errorf ("could not start aperture: %v" , err )
81
85
}
82
86
83
87
return nil
84
88
}
85
89
86
- func (hm * hashmailHarness ) stop () error {
90
+ // Stop attempts to stop the aperture proxy.
91
+ func (hm * HashmailHarness ) Stop () error {
87
92
return hm .aperture .Stop ()
88
93
}
0 commit comments