diff --git a/channel.go b/channel.go index a9c6837..8dec86f 100644 --- a/channel.go +++ b/channel.go @@ -104,7 +104,7 @@ func generateChannels(s *Session, amount int) []cchat.Server { // emulate network latency func emulateAustralianInternet() (lost bool) { - var ms = rand.Intn(internetMaxLatency) + internetMinLatency + var ms = rand.Intn(internetMaxLatency-internetMinLatency) + internetMinLatency <-time.After(time.Duration(ms) * time.Millisecond) // because australia, drop packet 20% of the time if internetCanFail is diff --git a/service.go b/service.go index daf84b9..4ccb102 100644 --- a/service.go +++ b/service.go @@ -47,9 +47,19 @@ type Authenticator struct{} var _ cchat.Authenticator = (*Authenticator)(nil) func (Authenticator) AuthenticateForm() []cchat.AuthenticateEntry { - return []cchat.AuthenticateEntry{{ - Name: "Username", - }} + return []cchat.AuthenticateEntry{ + { + Name: "Username", + }, + { + Name: "Password (ignored)", + Secret: true, + }, + { + Name: "Paragraph (ignored)", + Multiline: true, + }, + } } func (Authenticator) Authenticate(form []string) (cchat.Session, error) { @@ -61,7 +71,7 @@ var ( internetCanFail = true // 500ms ~ 3s internetMinLatency = 500 - internetMaxLatency = 2500 + internetMaxLatency = 3000 ) func (s Service) Configuration() (map[string]string, error) { @@ -90,7 +100,8 @@ func (s Service) SetConfiguration(config map[string]string) error { func unmarshalConfig(config map[string]string, key string, value interface{}) error { if err := json.Unmarshal([]byte(config[key]), value); err != nil { return &cchat.ErrInvalidConfigAtField{ - Key: key, Err: err, + Key: key, + Err: err, } } return nil