Documentation ¶
Overview ¶
Copyright © 2022 Zack Proser zackproser@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultNow = time.Now
DefaultNow is the default implementation of Procrastiproxy's Now function, as we want procrastiproxy to return the actual time during normal operations. In testing, we override this method with static values (e.g., 9:00PM or 3:23 AM) in test cases to simulate different wall-times for verifiying procrastiproxy's behavior
Functions ¶
func AddHostToBlockList ¶
Build the fast, in-memory list of blocked hosts from the configured values
func SlicesAreEqual ¶ added in v0.0.6
Types ¶
type AdminCommand ¶
type EmptyBlockListError ¶ added in v0.0.6
type EmptyBlockListError struct{}
func (EmptyBlockListError) Error ¶ added in v0.0.6
func (err EmptyBlockListError) Error() string
type InvalidTimeFormatError ¶ added in v0.0.6
func (InvalidTimeFormatError) Error ¶ added in v0.0.6
func (err InvalidTimeFormatError) Error() string
type List ¶
type List struct {
// contains filtered or unexported fields
}
func (*List) Clear ¶ added in v0.0.6
func (l *List) Clear()
Clear resets the list, deleting all members
type Procrastiproxy ¶
type Procrastiproxy struct { Now func() time.Time List *List ProxyTimeSettings }
func NewProcrastiproxy ¶
func NewProcrastiproxy() *Procrastiproxy
func (*Procrastiproxy) ConfigureProxyTimeSettings ¶
func (p *Procrastiproxy) ConfigureProxyTimeSettings(bts, bet string)
func (*Procrastiproxy) GetList ¶ added in v0.0.6
func (p *Procrastiproxy) GetList() *List
func (*Procrastiproxy) GetProxyTimeSettings ¶
func (p *Procrastiproxy) GetProxyTimeSettings() ProxyTimeSettings
func (*Procrastiproxy) WithinBlockWindow ¶
func (p *Procrastiproxy) WithinBlockWindow(now time.Time) bool